ammdyc @ 2024-08-05 10:53:23
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,g,x,num=1;
string a,b;
int main(){
cin>>n>>m>>a>>b;
a='0'+a;
b='0'+b;
for(int i=1;i<=n;i++){
if(a[i]=='#'){
g++;
}
}
m-=g;
if(m>=25)x=m/25;
for(int i=1;i<=n;i++){
if(a[i]=='#'){
a[i]=(char)(97+(num-1)%26);
if(x==0)num++;
else x--;
}
cout<<a[i];
}
return 0;
}
by 朱梓煊ZZX @ 2024-08-05 10:57:55
@ammdyc 你有没有发现你整个程序没有用到b字符串
by ammdyc @ 2024-08-05 10:59:49
@朱梓煊ZZX 因为b根本没用啊
by jrzhr @ 2024-08-05 11:02:11
@ammdyc 可b有用啊
by ammdyc @ 2024-08-05 11:03:12
@jrzhr 有啥用
by jrzhr @ 2024-08-05 11:05:15
举个例子 a=#a# b=########################## 这时候a最小可以是aaa
by ammdyc @ 2024-08-05 11:07:17
@jrzhr 你要不要运行一下,看看是不是aaa
by jrzhr @ 2024-08-05 11:07:57
@ammdyc 你代码是错的当然不是aaa
by ammdyc @ 2024-08-05 11:08:45
@jrzhr 而且b只需要25个#就可以满足了,不用26个
by jrzhr @ 2024-08-05 11:10:20
@ammdyc 确实,我打多了一个,但没影响
by ammdyc @ 2024-08-05 11:11:15
@jrzhr 可是我输出是aaa啊