1 条题解

  • 1
    @ 2023-10-17 18:23:23
    #include<iostream>
    #include<cmath>
    #include<cstdio>
    #include<algorithm> 
    #include<cstring>
    #include<string>
    using namespace std;
    int main(){
    	string s;
    	cin >> s;
    	for(int i=0;i<s.length();i++){
    		if(s[i]>='A'&&s[i]<='Z'){
    			s[i] = s[i]-'A'+'a';
    		}else if(s[i]>='a'&&s[i]<='z'){
    			s[i] = s[i]-'a'+'A';
    		}
    	}
    	string s1 = "";
    	for(int i=s.length()-1;i>=0;i--){
    		s1 += s[i];
    	}
    	for(int i=0;i<s1.length();i++){
    		if((s1[i]>='a'&&s1[i]<='w')||(s1[i]>='A'&&s1[i]<='W')){
    			s1[i]+=3;
    		}else if(s1[i] >'w'){
    			s1[i] = (s1[i]+3)%'z'+'a'-1;
    		}else if(s1[i] >'W'){
    			s1[i] = (s1[i]+3)%'Z'+'A'-1;
    		}
    	}
    	cout << s1;
    	return 0;
    }
    
    • 1

    信息

    ID
    6927
    时间
    1000ms
    内存
    128MiB
    难度
    1
    标签
    (无)
    递交数
    9
    已通过
    8
    上传者