提交时间:2023-08-22 11:30:00
运行 ID: 99179
#include<iostream> #include<cstring> using namespace std; int p1,p2,p3; char s[1000010]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>p1>>p2>>p3; cin>>s+1; int n=strlen(s+1); for( int i=1; i<=n; i++) { if(s[i]=='-'&&((s[i-1]<='9'&&s[i-1]>='0'&&s[i+1]<='9'&&s[i+1]>='0')||s[i-1]<='z'&&s[i+1]<='z'&&s[i-1]>='a'&&s[i+1]>='a')) { //判断减号旁边的两个字符是否为同一类型 if(s[i-1]>=s[i+1]) { cout<<'-'; continue; } if(p3==2) { for( int j=s[i+1]-1; j>s[i-1]; j--) { if(p1==3) { for( int k=1; k<=p2; k++)cout<<'*'; continue; } if(p1==1||(s[i-1]<='9'&&s[i-1]>='0')) { for( int k=1; k<=p2; k++)cout<<char(j); } else { for( int k=1; k<=p2; k++)cout<<char(j-('a'-'A')); } } } else { for( int j=s[i-1]+1; j<s[i+1]; j++) { if(p1==3) { for( int k=1; k<=p2; k++)cout<<'*'; continue; } if(p1==1||(s[i-1]<='9'&&s[i-1]>='0')) { for(int k=1; k<=p2; k++)cout<<char(j); } else { for(int k=1; k<=p2; k++)cout<<char(j-('a'-'A')); } } } continue; } cout<<s[i]; } return 0; }