70pts 求助
查看原帖
70pts 求助
1004460
OIer6666楼主2024/8/3 18:38
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	string a,b;
	int n,m;
	cin>>n>>m>>a>>b;
	int t=0;
	for(int i=0;i<n;i++)if(b[i]=='#')t++;
	int l=floor(t/26.0);
	t=26-(t-l*26)+1;
	int x=0,y=1,z=0;
	for(int i=0;i<n;i++){
		if(a[i]=='#'){
			if(z<l){
				a[i]='a';
				z++;
			}else{
				if((y-1)%26+1==t&&t!=1){
					y=1;
					t=0;
				}else if(t==1&&(y-1)%26+1==2){
					t=26;
					y=1;
				}
				a[i]=(y-1)%26+'a';
				y++;
			}
		}
	}
	cout<<a;
	return 0;
}

WA:7、8、9

2024/8/3 18:38
加载中...