R44577621 记录详情
测试点结果:
#1WA#2AC#3WA#4AC#5WA#6WA#7WA#8WA#9WA#10WA源代码:
#include"stdio.h"
#include"string"
#include"ctype.h"
using namespace std;
string readstr(void){//快读string
string ans="";
char tmp;
do{
tmp=getchar();
ans+=tmp;
}while(tmp!=' '&&tmp!='\n'&&tmp!=EOF);
ans.erase(ans.size()-1,1);
return ans;
}
void writestr(string a){//“快写”string
for(int i=0;i<a.size();i++)
putchar(a[i]);
}
string str_char(char a){//char转string
string ans="";
ans+=a;
return ans;
}
int main(void){
string a;
int p1,p2,p3;
scanf("%d%d%d",&p1,&p2,&p3);
a=readstr();
a=readstr();
for(int i=1;i<a.size()-1;i++)
if(a[i]=='-')
if((isdigit(a[i-1])&&isdigit(a[i+1])||islower(a[i-1])&&islower(a[i+1])||isupper(a[i-1])&&isupper(a[i+1]))&&a[i-1]<a[i+1]){
a.erase(i--,1);
if(p1==3)
for(int j=0;j<a[i+1]-a[i-1]-1;j++)
for(int k=0;k<p2;k++)
a.insert(++i,"*");
else{
if(isdigit(a[i-1])&&isdigit(a[i+1])){
if(p3==1)
for(char j=a[i-1]+1;j<a[i+1];j++)
for(int k=0;k<p2;k++)
a.insert(++i,str_char(j));
else
for(char j=a[i+1]-1;j>a[i-1];j--)
for(int k=0;k<p2;k++)
a.insert(++i,str_char(j));
}else{
if(p1==1){
if(p3==1)
for(char j=tolower(a[i-1])+1;j<tolower(a[i+1]);j++)
for(int k=0;k<p2;k++)
a.insert(++i,str_char(j));
else
for(char j=tolower(a[i+1])-1;j>tolower(a[i-1]);j++)
for(int k=0;k<p2;k++)
a.insert(++i,str_char(j));
}else{
if(p3==1)
for(char j=toupper(a[i-1])+1;j<toupper(a[i+1]);j++)
for(int k=0;k<p2;k++)
a.insert(++i,str_char(j));
else
for(char j=toupper(a[i+1])-1;j>toupper(a[i-1]);j++)
for(int k=0;k<p2;k++)
a.insert(++i,str_char(j));
}
}
}
}
writestr(a);
return 0;
}