70分(玄关求调)

P10836 『FLA - I』歌静河

StarlitDreams @ 2024-08-07 11:09:22

#include <bits/stdc++.h>
using namespace std;
const int N=200005;
int c[N];
int s,n,m,x,p;
string a,b;
int main(){
    cin>>n>>m;
    cin>>a>>b;
    for(int i=0;i<a.size();i++){
        if(a[i]=='#')s++;
    }
    s=m-s;
    x=s/26+1;
    for(int i=0;i<a.size();i++){
        if(a[i]!='#')continue;
        if(x){
            a[i]='a';
            x--;
        }
        else{
            p++;
            if(p>=26)p=0;
            //cout<<p<<" ";
            a[i]='a'+p;
        }
    }
    //cout<<"\n";
    cout<<a;
    return 0;
}

|