9 solutions

  • 5
    @ 2023-10-4 15:14:39
    #include<bits/stdc++.h>
    using namespace std;
    string n;
    int i;
    int main(){
    	getline(cin,n);
    	for(i=0;n[i];i++){
    		n[i]+=3;
    		if(n[i]>'z') n[i]='a'+n[i]-'z'-1;
    		else if(n[i]>'Z'&&n[i]<'a') n[i]='A'+n[i]-'Z'-1;
    		if(n[i]>='A'&&n[i]<='Z') n[i]+=32;
    		else if(n[i]>='a'&&n[i]<='z') n[i]-=32;
    	}
    	i--;
    	for(;i>=0;i--) cout<<n[i];
    	return 0;
    }
    

    短小精悍2.0

    • 3
      @ 2023-10-7 13:11:41
      #include <bits/stdc++.h>
      using namespace std;
      string s;
      int i;
      int main(int argc, char **argv){
      	getline(cin,s);
      	for(i = 0;s[i];i++){
      		if ((s[i] >= 'a' && s[i] <= 'w') || (s[i] >= 'A' && s[i] <= 'W')){
      			s[i] += 3;
      		}else if ((s[i] >= 'x' && s[i] <= 'z') || (s[i] >= 'X' && s[i] <= 'Z')){
      			s[i] -= 23;
      		}
      
      		if (s[i] >= 'A' && s[i] <= 'Z'){
      			s[i] += 32;
      		}else if (s[i] >= 'a' && s[i] <= 'z'){
      			s[i] -= 32;
      		}
      	}
      	i--;
      	for (;i >= 0;i--){
      		printf("%c",s[i]);
      	}
      	return 0;
      }
      
      • 2
        @ 2023-10-3 14:27:13
        ```
        #include<bits/stdc++.h>
        using namespace std;
        char dxxfz(char &ch){//将一个字符大小写反转的函数
            if('a'<=ch&&ch<='z')ch=toupper(ch);//如果是小写,变为大写
            else if('A'<=ch&&ch<='Z')ch=tolower(ch);//如果是大写,变为小写
            return ch;
        }
        char yyswz(char &ch){//将一个字母表中的字符循环右移3位的函数
            if('a'<=ch&&ch<='w')ch+=3;//如果在 a 与 w 之间则直接右移3位
            else if('A'<=ch&&ch<='W')ch+=3;//如果在 A 与 W 之间则直接右移3位
            else if('x'<=ch&&ch<='z')ch-=23;//如果在 x 与 z 之间则循环右移3位
            else if('X'<=ch&&ch<='Z')ch-=23;//如果在 X 与 Z 之间则循环右移3位
            return ch;
        }
        int main(){
            string s;cin>>s;
            transform(s.begin(), s.end(), s.begin(),dxxfz);
            reverse(s.begin(),s.end());
            transform(s.begin(), s.end(), s.begin(),yyswz);
            /* transform 函数的作用是:将某操作应用于指定范围的每个元素。 
            transform 函数有两个重载版本:
         transform(first,last,result,op);
         first 是容器的首迭代器, last 为容器的末迭代器, result 为存放结果的容器, op 为要进行操作的一元函数对象或  sturct 、 class 。
         transform(first1,last1,first2,result,binary_op); 
         first1是第一个容器的首迭代器,last1 为第一个容器的末迭代器,first2 为第二个容器的首迭代器, result 为存放结果的容器, binary_op 为要进行操作的二元函数 对象或 sturct 、 class 。
         这里我们使用的是第一个。
         */
            cout<<s;//输出解密后的字符串
            return 0;//返回0
        }
        
        • 1
          @ 2024-1-22 14:17:13
          #include<bits/stdc++.h>
          using namespace std;
          string a;
          string b; 
          int main(){
              cin>>a;
              for(int i=0;i<a.size();i++){
          		if(a[i]=='z'){
          			a[i]='c'; 
          		}
          		else if(a[i]=='x'){
          			a[i]='a'; 
          		}
          		else if(a[i]=='y'){
          			a[i]='b'; 
          		}
          		else if(a[i]<'y'&&a[i]>='a'){
          			a[i]=a[i]+3;
          		}
          	}
          	for(int i=0;i<a.size();i++){
          		if(a[i]=='Z'){
          			a[i]='C'; 
          		}
          		else if(a[i]=='X'){
          			a[i]='A'; 
          		}
          		else if(a[i]=='Y'){
          			a[i]='B'; 
          		}
          		else if(a[i]<'Y'){
          			a[i]=a[i]+3;
          		}
          	}
              for(int i=0;i<a.size();i++){
          		if(a[i]>=65&&a[i]<=90){
          			a[i]=a[i]+32; 
          		}
          		else {
          			a[i]=a[i]-32;
          		}
          	}
          	for(int i=0;i<a.size();i++){
          		b[i]=a[i];
          	}
          	for(int i=a.size()-1,j=0;i>=0&&j<a.size();i--,j++){
          		a[i]=b[j];
          	}
          
          	for(int i=0;i<a.size();i++){
          		cout<<a[i];
          	}
          }
          
          • 1
            @ 2023-12-25 20:30:24
            #include <bits/stdc++.h>
            using namespace std;
            string n;
            int i;
            int main(){
            	getline(cin,n);
            	for(i=0;n[i];i++){
            		n[i]+=3;
            		if(n[i]>'z') n[i]='a'+n[i]-'z'-1;
            		else if(n[i]>'Z'&&n[i]<'a') n[i]='A'+n[i]-'Z'-1;
            		if(n[i]>='A'&&n[i]<='Z') n[i]+=32;
            		else if(n[i]>='a'&&n[i]<='z') n[i]-=32;
            	}
            	i--;
            	for(;i>=0;i--) cout<<n[i];
            	return 0;
            }
            
            • 0
              @ 2024-8-30 20:55:49
              #include<queue>
              #include<stack>
              #include<cmath>
              #include<algorithm>
              #include<cstring>
              using namespace std;   
              int main()
              {
                  int a;
              	int b[20000],c[20000]={0};
              	cin>>a;  
                  for(int i=0;i<a;i++) 
                  {
                  	cin>>b[i];
              	}
                  for(int i=0;i<a;i++)  
                  {
                  	for(int j=i+1;j<a;j++)  
              	    {
              	    	if(b[i]==b[j])
              	    	{
              	    		c[j]=1;
              			}
              	    }
                  }
                  for(int i=0;i<a;i++)  
                  {
                  	if(c[i]==1)
                  	{
                  		continue;
              		}
              		else
              		{
              			cout<<b[i]<<" ";
              		}
                  }
                  return 0;             
              }- [ ] - 1.
              • 0
                @ 2024-7-9 20:54:05
                #include<bits/stdc++.h>
                using namespace std;
                
                string recodea(string name){
                	for(int i=0;i<=name.size();i++){
                		if(name[i]=='X')name[i]='A';
                		else if(name[i]=='Y')name[i]='B';
                		else if(name[i]=='Z')name[i]='C';
                		else if(name[i]=='x')name[i]='a';
                		else if(name[i]=='y')name[i]='b';
                		else if(name[i]=='z')name[i]='c';
                		else name[i]+=3;
                	}
                	return name;
                }
                
                string recodeb(string name){
                	int length=name.size();
                	if(length%2==0){
                		for(int i=0;i<length/2;i++){
                			swap(name[i],name[length-i-1]);
                		}
                	}
                	else{
                		for(int i=0;i<=((length-1)/2);i++){
                			swap(name[i],name[length-i-1]);
                		}
                	}
                	
                	return name;
                }
                
                string recodec(string name){
                	for(int i=0;i<=name.size();i++){
                		if(name[i]<='Z'&&name[i]>='A') name[i]+=32;
                		else name[i]-=32;
                	}
                	return name;
                }
                int main(){
                	string name;
                	cin>>name;
                	string name1=recodea(name);
                	string name2=recodeb(name1);
                	string name3=recodec(name2);
                	cout<<name3;
                	
                	return 0;
                }
                

                真就花了我一个半小时修代码呗,也不长

                • 0
                  @ 2023-10-4 13:20:14

                  #include<bits/stdc++.h> using namespace std; int correct[260]; int memory[260]; int main(){ string s; int o=0; getline(cin,s); int ssize=int(s.size()); for(int l=0;l<ssize;l++){ if(s[l]>='A'&&s[l]<='Z'){ s[l]+=32; } else{ s[l]-=32; } } for(int u=0;u<ssize;u++){ memory[u]=s[u]; } for(int j=ssize-1;j>=0;j--){ s[j]=memory[o]; o+=1; } for(int i=0;i<ssize;i++){ if(s[i]'x'){ s[i]='a'; } else if(s[i]'X'){ s[i]='A'; } else if(s[i]'y'){ s[i]='b'; } else if(s[i]'Y'){ s[i]='B'; } else if(s[i]'Z'){ s[i]='C'; } else if(s[i]'z'){ s[i]='c'; } else if(s[i]>='a'&&s[i]<='w'){ s[i]+=3; } else if(s[i]>='A'&&s[i]<='w'){ s[i]+=3; } else{ s[i]=s[i]; } } cout<<s; return 0; }

                  • 0
                    @ 2023-10-3 14:27:02
                    
                    

                    #include<bits/stdc++.h> using namespace std; char dxxfz(char &ch){//将一个字符大小写反转的函数 if('a'<=ch&&ch<='z')ch=toupper(ch);//如果是小写,变为大写 else if('A'<=ch&&ch<='Z')ch=tolower(ch);//如果是大写,变为小写 return ch; } char yyswz(char &ch){//将一个字母表中的字符循环右移3位的函数 if('a'<=ch&&ch<='w')ch+=3;//如果在 a 与 w 之间则直接右移3位 else if('A'<=ch&&ch<='W')ch+=3;//如果在 A 与 W 之间则直接右移3位 else if('x'<=ch&&ch<='z')ch-=23;//如果在 x 与 z 之间则循环右移3位 else if('X'<=ch&&ch<='Z')ch-=23;//如果在 X 与 Z 之间则循环右移3位 return ch; } int main(){ string s;cin>>s; transform(s.begin(), s.end(), s.begin(),dxxfz); reverse(s.begin(),s.end()); transform(s.begin(), s.end(), s.begin(),yyswz); /* transform 函数的作用是:将某操作应用于指定范围的每个元素。 transform 函数有两个重载版本: transform(first,last,result,op); first 是容器的首迭代器, last 为容器的末迭代器, result 为存放结果的容器, op 为要进行操作的一元函数对象或 sturct 、 class 。 transform(first1,last1,first2,result,binary_op); first1是第一个容器的首迭代器,last1 为第一个容器的末迭代器,first2 为第二个容器的首迭代器, result 为存放结果的容器, binary_op 为要进行操作的二元函数 对象或 sturct 、 class 。 这里我们使用的是第一个。 */ cout<<s;//输出解密后的字符串 return 0;//返回0 }

                    
                    
                    • 1

                    Information

                    ID
                    623
                    Time
                    1000ms
                    Memory
                    256MiB
                    Difficulty
                    7
                    Tags
                    # Submissions
                    188
                    Accepted
                    48
                    Uploaded By