2 条题解
-
2
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for(int i = 0; i < s.length(); i++) { if(s[i] >= 'a' and s[i] <= 'z') { s[i] = 'z' - s[i] + 'a'; } else if(s[i] >= 'A' and s[i] <= 'Z') { s[i] = 'Z' - s[i] + 'A'; } } cout << s; return 0; }
-
1
#include <iostream> #include <string> using namespace std; int main() { string a; getline(cin, a); for (int i = 0; i < a.size(); i++) { if (a[i] >= 65 && a[i] <= 90) { cout << (char)(155 - a[i]);//155=(90+65)/2,找中间就好了 } else if (a[i] >= 97 && a[i] <= 122) { cout << (char)(219 - a[i]); } else { cout << a[i]; } } }
- 1
信息
- ID
- 133
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- 1
- 标签
- 递交数
- 57
- 已通过
- 49
- 上传者