80pts RE#5#7 求调
查看原帖
80pts RE#5#7 求调
632063
shipeiqian楼主2024/11/19 20:08
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int a,b,c;
string s;
int main(){
    cin >>a >>b >>c >>s;
    vector<string>ans;
    for(int i=0;i<s.size();i++){
        if(s[i]=='-'){
            char l=s[i-1],r=s[i+1];
            if(l+1==r)continue;
            if(l>=r||(!((l>='a'&&l<='z'&&r>='a'&&r<='z')||(l>='0'&&l<='9'&&r>='0'&&r<='9')))){
                ans.push_back("-");
                continue;
            }
            string t="";
            if(l>='0'&&l<='9'){
                for(char j=l+1;j<=r-1;j++){
                    for(int k=1;k<=b;k++){
                        t+=(a==3?'*':j);
                    }
                }
            }
            else{
                for(char j=l+1;j<=r-1;j++){
                    for(int k=1;k<=b;k++){
                        if(a==1)t+=tolower(j);
                        if(a==2)t+=toupper(j);
                        if(a==3)t+='*';
                    }
                }
            }
            if(c==2){
                reverse(t.begin(),t.end());
            }
            ans.push_back(t);
//            cout <<t <<"\n";
        }
    }
    int now=0;
    for(auto x:s){
        if(x=='-'){
        	if(ans.size()){
        		cout <<ans[now];	
        		now++;
			}
            
        }
        else cout <<x;
    }
    return 0;
}
2024/11/19 20:08
加载中...