50pts WA #5~9 悬棺求调

P10836 『FLA - I』歌静河

leozhao123 @ 2024-10-24 21:37:29

记录

#include<iostream>
using namespace std;
const int N=1e5+3;
int n,m,na,nb;
char a[N],b[N];
int main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>m;
    for(int i=0;i<n;++i) {
        cin>>a[i];
        if(a[i]=='#') ++na;
    }
    cin>>b;
    nb=m-na;
    int i=0;
    for(;i<n;++i) {
        if(nb<26) break;
        if(a[i]=='#') a[i]='a',nb-=25;
    }
    for(int j=0;j<26-nb&&i<n;++i) {
        if(a[i]=='#') a[i]='a'+j++;
    }
    for(int j=0;i<n;++i) {
        if(a[i]=='#') a[i]='a'+j++;
    }
    cout<<a;
    return 0;
}

by leozhao123 @ 2024-11-08 20:19:41

70pts 新记录


|