提交时间:2023-08-22 11:19:38
运行 ID: 99164
#include<bits/stdc++.h> //#define int long long using namespace std; namespace Fast{ inline int fr(){ register int x = 0,f = 1; static char c = getchar(); while (c < '0' || c > '9'){ if (c == '-'){ f = -1; } c = getchar(); } while (c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void fw(int x){ if (x < 0){ x = -x; putchar('-'); } if (x > 9){ fw(x / 10); } putchar(x % 10 + 48); } } using namespace Fast; int a,b,c; inline void check(char s,char t){ string ret = ""; if (a == 3){ for (char ch = s + 1;ch <= t - 1;ch++){ for (int i = 1;i <= b;i++){ ret += '*'; } } } else{ if (s >= '0' && s <= '9'){ for (char ch = s + 1;ch <= t - 1;ch++){ for (int i = 1;i <= b;i++){ ret += ch; } } } else if (s >= 'a' && s <= 'z'){ for (char ch = s + 1;ch <= t - 1;ch++){ for (int i = 1;i <= b;i++){ ret += (char)(ch + (a == 2?'A' - 'a':0)); } } } } if (c == 2){ reverse(ret.begin(),ret.end()); } cout<<ret; } signed main(){ a = fr(),b = fr(),c = fr(); string s; cin>>s; for (int i = 0;i < s.size();i++){ if (s[i] != '-' || i == 0){ putchar(s[i]); } else{ if (s[i] == s[i - 1] && s[i] == '-'){ putchar('-'); continue; } char o = s[i - 1],p = s[i + 1]; if (p < o){ putchar('-'); continue; } if ((int)(p - o) == 1){ continue; } if (o >= '0' && o <= '9' && (p < '0' || p > '9')){ putchar('-'); continue; } if (p >= '0' && p <= '9' && (o < '0' || o > '9')){ putchar('-'); continue; } if (o == p){ putchar('-'); continue; } check(o,p); } } return 0; }