样例过了,爆0求助!
查看原帖
样例过了,爆0求助!
935829
QiuOutlook楼主2024/12/29 11:57

代码如下:

#include<bits/stdc++.h>
using namespace std;
int a,b,c;
string y;
int main(){
	cin>>a>>b>>c;
	getchar();
	getline(cin,y);
	y=' '+y;
	cout<<endl;
	for(int i=1;i<y.size();i++){
		if(y[i]!='-'){
			cout<<y[i];
			continue;
		}
		char l=y[i-1],r=y[i+1];
		if(l==r-1) continue;
		if(l>=r){
			cout<<'-';
			continue;
		}
		if(l>='a'&&l<='z'){
//			cout<<"*letter*";
			int upper=0,d=1;
			char be=l,en=r;
			if(a==2) upper=1;
			if(a==3) upper=-1;
			if(c==2){
				swap(be,en);
				d=-1;
			}
			for(be+=d;be!=en;be+=d){
				for(int j=1;j<=b;j++){
					if(upper==-1) cout<<'*';
					else if(upper==1) cout<<(char)toupper(be);
					else cout<<be;
				}
			}
		}
		if(l>='0'&&l<='9'){
//			cout<<"*number*";
			int upper=0,d=1;
			char be=l,en=r;
			if(a==3) upper=-1;
			if(c==2){
				swap(be,en);
				d=-1;
			}
			for(be+=d;be!=en;be+=d){
				for(int j=1;j<=b;j++){
					if(upper==-1) cout<<'*';
					else cout<<be;
				}
			}
		}
	}
	return 0;
}
2024/12/29 11:57
加载中...