70分求调!!!
查看原帖
70分求调!!!
934390
__HappY__楼主2024/8/19 20:37
#include<bits/stdc++.h>
using namespace std;
int n, m;
string a, b;
int j = 0;
int tot = 1;
int main() {
	cin >> n >> m;
	cin >> a >> b;
	for(int i = 1; i <= n; i++) {
		if(a[i - 1] == '#') j++;
	}
	if(j == 0) {
		cout << a;
		return 0;
	}
	j = m - j;
	if(j == 0) {
		for(int i = 0; i < n; i++) {
			if(a[i] == '#') {
				cout << (char) ((tot - 1) % 26 + 'a');
				tot++;
			}
			else cout << a[i];
		}
		return 0;
	}
	for(int i = 0; i < n; i++) {
		if(a[i] == '#') {
			if(j >= 26) {
				cout << 'a';
				j -= 26;
			}
			else {
				cout << (char) ((tot - 1) % 26 + 'a');
				tot++;
			}
		}
		else cout << a[i];
	}
	return 0;
}

也可以给 hack 数据

悬赏一枚关注

2024/8/19 20:37
加载中...