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

void ppp(int x) {
	if (p3 == 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 {
		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 << '*';
			}
		}
	}
}

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

	return 0;
}
2025/1/3 21:26
加载中...