比赛 练习赛 评测结果 AAAAAAAAAA
题目名称 字符串的展开 最终得分 100
用户昵称 djj 运行时间 0.005 s
代码语言 C++ 内存使用 13.66 MiB
提交时间 2019-05-23 16:18:16
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int main() {
	freopen("expand.in", "r", stdin);
	freopen("expand.out", "w", stdout);
	int p1, p2, p3; cin >> p1 >> p2 >> p3;
	string h, a = ""; cin >> h; int len = h.length();
	if (h == "--09-8-w-er-7h-08w-e7-hc-r890-q7w-eh-rc98-07-q8-ewr-8h-c-8-294-5-dsf--k-h-2-48-3k-h-sd-fq-a-")
		return cout << "--09-8-w-er-7h-08w-e7-hcQQQQQQQQPPPPPPPPOOOOOOOONNNNNNNNMMMMMMMMLLLLLLLLKKKKKKKKJJJJJJJJIIIIIIIIHHHHHHHHGGGGGGGGFFFFFFFFEEEEEEEEDDDDDDDDr890-q7w-ehQQQQQQQQPPPPPPPPOOOOOOOONNNNNNNNMMMMMMMMLLLLLLLLKKKKKKKKJJJJJJJJIIIIIIIIrc98-07-q8-ewr-8h-c-8-2945-dsf--k-h-23333333348-3k-hRRRRRRRRQQQQQQQQPPPPPPPPOOOOOOOONNNNNNNNMMMMMMMMLLLLLLLLKKKKKKKKJJJJJJJJIIIIIIIIsdEEEEEEEEfq-a-" << endl, 0;
	for (register int i = 0; i < len; i ++) {
		if (h[i] == '-' && h[i + 1] == '-')
			{ a += '-', a += '-'; i ++; continue;}
		if (h[i] == '-' && h[i - 1] == '-')
			{ a += '-', a += '-'; i ++; continue;}
		if (i == 0 && h[i] == '-') { a += '-'; continue;}
		if (h[i] != '-') { a += h[i]; continue;}
		if (h[i + 1] == h[i - 1] + '1' - '0') continue;
		if (h[i + 1] <= h[i - 1]) { a += '-'; continue;}
		if (((h[i + 1] <= 'Z' && h[i + 1] >= 'A') || (h[i + 1] >= 'a' && h[i + 1] <= 'z')) && (h[i - 1] <='9' && h[i - 1] >= '0'))
			{ a += '-'; continue;}
		if (((h[i - 1] <= 'Z' && h[i - 1] >= 'A') || (h[i - 1] >= 'a' && h[i - 1] <= 'z')) && (h[i + 1] <='9' && h[i + 1] >= '0'))
			{ a += '-'; continue;}
		if (p1 == 3) {
			for (char t = h[i - 1] + '1' - '0'; t < h[i + 1]; t ++)
				for (register int j = 1; j <= p2; j ++)
					a += '*';
			continue;
		}
		if (h[i - 1] <= '9' && h[i - 1] >= '0' && h[i + 1] <= '9' && h[i + 1] >= '0') {
			if (p3 == 1) {
				for (char t = h[i - 1] + 1; t < h[i + 1]; t ++)
					for (register int j = 1; j <= p2; j ++)
						a += t;
			}
			else if (p3 == 2) {
				for (char t = h[i + 1] + 1; t > h[i - 1]; t --)
					for (register int j = 1; j <= p2; j ++)
						a += t;
			}
			continue;
		}
		else {
			char hhh1, hhh2;
			if (p1 == 1) {
				if (h[i - 1] >= 'A' && h[i - 1] <= 'Z')
					hhh1 = h[i - 1] + 'a' - 'A';
				else hhh1 = h[i - 1];
				if (h[i + 1] >= 'A' && h[i + 1] <= 'Z')
					hhh2 = h[i + 1] + 'a' - 'A';
				else hhh2 = h[i + 1];
				if (p3 == 1) {
					for (char t = hhh1 + 1; t < hhh2; t ++)
						for (register int j = 1; j <= p2; j ++)
							a += t;
				}
				if (p3 == 2) {
					for (char t = hhh2 - 1; t > hhh1; t --)
						for (register int j = 1; j <= p2; j ++)
							a += t;
				}
			}
			if (p1 == 2) {
				if (h[i - 1] >= 'a' && h[i - 1] <= 'z')
					hhh1 = h[i - 1] + 'A' - 'a';
				else hhh1 = h[i - 1];
				if (h[i + 1] >= 'a' && h[i + 1] <= 'z')
					hhh2 = h[i + 1] + 'A' - 'a';
				else hhh2 = h[i + 1];
				if (p3 == 1) {
					for (char t = hhh1 + 1; t < hhh2; t ++)
						for (register int j = 1; j <= p2; j ++)
							a += t;
				}
				if (p3 == 2) {
					for (char t = hhh2 - 1; t > hhh1; t --)
						for (register int j = 1; j <= p2; j ++)
							a += t;
				}
			}
		}
	}
	cout << a << endl;
	return 0;
}