S a m p l e Sample Sample I n p u t Input Input#1
1 2 1
abcs-w1234-9s-4zz
S a m p l e Sample Sample I n p u t Input Input#2
2 3 2
a-d-d
S a m p l e Sample Sample I n p u t Input Input#3
3 4 2
di-jkstra2-6
S a m p l e Sample Sample O u t p u t Output Output#1
abcsttuuvvw1234556677889s-4zz
S a m p l e Sample Sample O u t p u t Output Output#2
aCCCBBBd-d
S a m p l e Sample Sample O u t p u t Output Output#3
dijkstra2************6
H i n t Hint Hint
T r a i n Train Train o f of of T h o u g h t Thought Thought
大模拟
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char c, sx, sy, si, sj;
int x, y, z;
string s;
bool b;
int main()
{
// freopen("1.out","w",stdout);
scanf("%d%d%d", &x, &y, &z);
cin>>sx;b = 0;
while(cin>>c)
{
if(c == '-' && sx != '-')//特判减号有一边也是减号
{
sy = ' ';//判断是否读完
cin>>sy;
if(!b)cout<<sx;//若它未输出过
if(sy == ' ')cout<<'-';//判断是否读完
else if(sx == sy || sx > sy || (sx <= '9' && sy >= 'A')//特判字母/数字相同或左边大于右边
|| (sy <= '9' && sx >= 'A') || (sx <= 'Z' && sy >='a')//特判两边的类型不同
|| (sy <= 'Z' && sx >='a')){cout<<c<<sy;sx = sy;b = 1;}
else if(sx + 1 == sy){cout<<sy;sx = sy;b = 1;}//特判两个字母/数字是连续的
else
{
si = sx, sj = sy;
if(x == 1)if(sx >= 'A' && sx <= 'Z')si = sx + 32, sj = sy + 32;//小写字母
if(x == 2)if(sx >= 'a' && sx <= 'z')si = sx - 32, sj = sy - 32;//大写字母
if(x == 3)
{
for(int i = 1; i <= (sy - sx - 1) * y; i++)
cout<<'*';//星号
}
else if(z == 1)
{
for(int i = 1; i <= sy - sx - 1; i++)
for(int j = 1; j <= y; j++)
cout<<(char)(si + i);//正序输出
}
else if(z == 2)
{
for(int i = 1; i <= sy - sx - 1; i++)
for(int j = 1; j <= y; j++)
cout<<(char)(sj - i);//倒叙输出
}
cout<<sy;
sx = sy;//防止此字母后面还是个减号
b = 1;
}
}
else
{
if(sx != ' ' && !b)cout<<sx;
sx = c;
b = 0;
}
}
if(sx != ' ' && !b)cout<<sx;
return 0;
}