4 条题解

  • 2
    @ 2023-12-2 20:23:30
    #include <bits/stdc++.h> 
    using namespace std;
    char shift(char c)
    {
        if(c >= 'a' and c <= 'y')
        {
            c += 1;
        }
        else if(c >= 'A' and c <= 'Y')
        {
            c += 1;
        }
        else if(c == 'z')
        {
            c = 'a';
        }
        else if(c == 'Z')
        {
            c = 'A';
        }
        return c;
    }
    int main()
    {
        string s;
        while(cin >> s)
        {
            for(int i = 0; i < s.length(); i++)
            {
                cout << shift(s[i]);
            }
            cout << " ";
        }
        return 0;
    }
    
    • 2
      @ 2023-10-1 10:39:38
      #include <bits/stdc++.h>
      using namespace std;
      int main(){
          string s;
          getline(cin,s);
          for(int i=0;i<s.size();i++){
              if(s[i]>='A'&&s[i]<='Z')s[i]=='Z'?s[i]='A':s[i]++;
              else if(s[i]>='a'&&s[i]<='z')s[i]=='z'?s[i]='a':s[i]++;
          }
          cout<<s<<endl;
          return 0;
      }
      
      • 2
        @ 2023-8-4 0:34:21

        自测可能会错误 但提交没事awa

        已AC,放心食用

        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        	char a[80];
        	gets(a); //输入字符串
        	for(unsigned int i=0;i<strlen(a);i++){ //枚举
        		if((a[i]>='a' && a[i]<='z') || (a[i]>='A' && a[i]<='Z')){ //如果是英文
        			if(a[i]=='z') cout<<"a";//z变a
        			else if(a[i]=='Z') cout<<"A";//Z变A
        			else cout<<char(a[i]+1);//其他的变后一个	
        		}
        		else cout<<char(a[i]); //符号不变
        	}
        	return 0;
        }
        
        • -2
          @ 2023-9-3 12:25:50

          #include<bits/stdc++.h> using namespace std; int main() { char a[80]; gets(a); //输入字符串 for(unsigned int i=0;i<strlen(a);i++){ //枚举 if((a[i]>='a' && a[i]<='z') || (a[i]>='A' && a[i]<='Z')){ //如果是英文 if(a[i]'z') cout<<"a";//z变a else if(a[i]'Z') cout<<"A";//Z变A else cout<<char(a[i]+1);//其他的变后一个 } else cout<<char(a[i]); //符号不变 } return 0; }

          • 1

          信息

          ID
          399
          时间
          1000ms
          内存
          16MiB
          难度
          3
          标签
          递交数
          62
          已通过
          34
          上传者