30pts求条
查看原帖
30pts求条
1140668
___W___Z___L___PVP楼主2025/1/2 21:13
#include <bits/stdc++.h>
using namespace std;
int p1, p2, p3;
string a;

void ppp(int x) {
	if (p3 == 1) {
		cout << a[x - 1];
		for (int i = a[x - 1] + 1; i < a[x + 1]; i++) {
			for (int j = 1; j <= p2; j++) {
				if (p1 == 1)
					cout << char(i);
				else if (p1 == 2)
					cout << char(i - 'A' + 1);
				else
					cout << '*';
			}
		}
	} else {
		cout << a[x - 1];
		for (int i = a[x + 1] - 1; i >= a[x - 1] + 1; i--) {
			for (int j = 1; j <= p2; j++) {
				if (p1 == 1)
					cout << char(i);
				else if (p1 == 2)
					cout << char(i - 32);
				else
					cout << '*';
			}
		}
	}
	if (a[x + 2] != '-')
		cout << a[x + 1];
}

int main() {
	cin >> p1 >> p2 >> p3 >> a;
	for (int i = 0; i < (int)a.size();) {
		if (a[i] != '-' && a[i + 1] != '-')
			cout << a[i], i++;
		else if (a[i] != '-' && a[i + 1] == '-') {
			i++;
			continue;
		} else {
			if (a[i - 1] + 1 == a[i + 1])
				cout << a[i - 1] << a[i + 1], i += 2;
			else if (a[i - 1] >= a[i + 1])
				cout << a[i - 1] << a[i] << a[i + 1], i += 2;
			else {
				ppp(i);
				i += 2;
			}
		}
	}

	return 0;
}

WA 1,3,4,5,6,7,8

2025/1/2 21:13
加载中...