2 条题解

  • 3
    @ 2023-8-4 0:08:16

    随便写的 已AC,放心食用

    #include <iostream>
    #include <cstring>
    using namespace std;
    int main(){
        int n;
        string s;
        getline(cin, s);
        for (unsigned int i=0; i<s.size(); i++){
            if (s[i]>='A'&&s[i]<='Z'){ // 判断是否大写字母
                n = s[i]-'A';
                n = (n+26-5)%26; // 防止负数
                s[i] = n+'A';
            }
        }
        cout << s << endl;
        return 0;
    }
    
    • 1
      @ 2023-10-28 21:09:42
      #include <bits/stdc++.h>
      using namespace std;
      int main(){
          string s;
          getline(cin,s);
          for(int i=0;i<s.length();i++)if(s[i]>='A'&&s[i]<='Z')s[i]='A'+(s[i]-'A'+21)%26;
          cout<<s<<endl;
          return 0;
      }
      
      • 1

      信息

      ID
      384
      时间
      1000ms
      内存
      16MiB
      难度
      2
      标签
      递交数
      65
      已通过
      41
      上传者