Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
26857 | 唐心 | China”译成密码 | C++ | Accepted | 1 MS | 676 KB | 377 | 2022-05-24 17:14:24 |
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { int i; char str[100]="China"; char newstr[100]={0}; for(i=0;i<strlen(str);i++) { if('a'<=str[i] && str[i]<='z') newstr[i] = (char)(((int)(str[i])-97+4)%26+97); else newstr[i] = (char)(((int)(str[i])-65+4)%26+65); } cout<<newstr<<endl; return 0; }