P1914 小书童——密码

P1914 小书童——凯撒密码

houfuhao @ 2019-06-10 09:14:53

include <iostream>

include <cstdio>

using namespace std; int main() { int n; cin >> n; getchar(); char ss[51]; int sss[51]; cin.get(ss,51); int i = 0; while (ss[i] != '\0') { sss[i] = (int)ss[i] + n; if (sss[i] > 122)//‘z’的ascii为122 sss[i] -= 26; ss[i] = (char)sss[i]; cout << ss[i]; i++; }
cout << endl; return 0; } 我测试数据都是对的,提交却全部是WA,请大神看看哪里有错啊


by 茶道先辈 @ 2019-06-10 09:17:00

%%%


by 茶道先辈 @ 2019-06-10 09:22:41

您太强了


by 茶道先辈 @ 2019-06-10 09:37:42

#include<stdio.h>
#include<string.h>

int main(){ int n; scanf("%d",&n); if(n>=26)n%=26; char c[55]; scanf("%s",c); for(int i=0;i<strlen(c);i++){ int a=c[i]+n; if(a>'z')a-=26; printf("%c",a); } }


by 茶道先辈 @ 2019-06-10 09:37:54

这不就行了吗


by ywy_c_asm @ 2019-06-10 09:38:41

@秦冉非 然而这还是不行……


by 茶道先辈 @ 2019-06-10 09:43:53

我a了就行


by 行者_Walker @ 2019-06-10 09:44:03

希望更丰富的展现?使用Markdown


by 茶道先辈 @ 2019-06-10 09:45:33

使用Markdown


by XMK_萌新 @ 2019-06-10 12:22:29

markdown$ $Good!

|