记录编号 |
447833 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2007]字符串的展开 |
最终得分 |
100 |
用户昵称 |
liuyu |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.005 s |
提交时间 |
2017-09-11 16:47:57 |
内存使用 |
0.32 MiB |
显示代码纯文本
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
freopen("expand.in","r",stdin);
freopen("expand.out","w",stdout);
int p1,p2,p3,z,i,j;
string s;
cin>>p1>>p2>>p3;
cin>>s;
int l = s.size();
for(z=0;z<l;z++){
if(s[z]!='-'){
cout<<s[z];
continue;
}
if((s[z]=='-')&&(z==0 || z==l-1 )){
cout<<'-';
continue;
}
if( ((s[z-1]>='0'&&s[z-1]<='9'&&s[z+1]>='0'&&s[z+1]<='9'&&s[z-1]>=s[z+1])
||(s[z-1]>='a'&&s[z-1]<='z'&&s[z+1]>='a'&&s[z+1]<='z'&&s[z-1]>=s[z+1])
||(s[z-1]>='0'&&s[z-1]<='9'&&s[z+1]>='a'&&s[z+1]<='z')
||(s[z-1]>='a'&&s[z-1]<='z'&&s[z+1]>='0'&&s[z+1]<='9'))
||(s[z-1]=='-')
||(s[z+1]=='-')){
cout<<'-';
continue;
}
if( (s[z-1]>='0')&&(s[z-1]<='9')&&(s[z+1]>='0')&&(s[z+1]<='9') ){
if(p1==3){
for(i=s[z-1]+1;i<=s[z+1]-1;i++)
for(j=1;j<=p2;j++)
cout<<'*';
continue;
}
if(p3==1){
for(i=s[z-1]+1;i<=s[z+1]-1;i++)
for(j=1;j<=p2;j++)
cout<<(char)(i);
continue;
}
for(i=s[z+1]-1;i>=s[z-1]+1;i--)
for(j=1;j<=p2;j++)
cout<<(char)(i);
}
if( (s[z-1]>='a')&&(s[z-1]<='z')&&(s[z+1]>='a')&&(s[z+1]<='z') ){
if(p1==3){
for(i=s[z-1]+1;i<=s[z+1]-1;i++)
for(j=1;j<=p2;j++)
cout<<'*';
continue;}
if(p1==1){
if(p3==1){
for(i=s[z-1]+1;i<=s[z+1]-1;i++)
for(j=1;j<=p2;j++)
cout<<(char)(i);
continue;}
for(i=s[z+1]-1;i>=s[z-1]+1;i--)
for(j=1;j<=p2;j++)
cout<<(char)(i);
continue;
}
if(p3==1){
for(i=s[z-1]+1;i<=s[z+1]-1;i++)
for(j=1;j<=p2;j++)
cout<<(char)(i-32);
continue;}
for(i=s[z+1]-1;i>=s[z-1]+1;i--)
for(j=1;j<=p2;j++)
cout<<(char)(i-32);
continue;
}
}
return 0;
}