_hello_w_ @ 2021-12-17 16:48:06
# include <bits/stdc++.h>
using namespace std;
int n;
string a;
char b[55];
int main()
{
cin>>n>>a;
for (int i = 0; i < a.size(); i++)
{
b[i] = (a[i] + n - 97) % 26 +'a';
}
for (int i = 0; i < a.size(); i++) cout<<b[i];
return 0;
}
by _hello_w_ @ 2021-12-17 16:50:11
看了不少,测试通过,但是洛谷不通过,请高手来点评,char类型数据也是+-127之内,取余26无论在for循环内还是之外,结果都逸测试,完全相同。
by 0htoAi @ 2021-12-17 16:52:47
?
by _hello_w_ @ 2021-12-17 18:23:20
只看不说???啥意思
by _hello_w_ @ 2021-12-17 18:48:38
@仇哥
by _hello_w_ @ 2021-12-17 18:50:11
@Access_Denied 求指点
by _hello_w_ @ 2021-12-17 18:51:14
@ksydom 求指点
by _hello_w_ @ 2021-12-17 18:51:54
@0htoAi 说点呀
by _hello_w_ @ 2021-12-17 18:54:08
题目解剖: 1、char的值长度; 2、asc码与整数转换 3、字符数组的输入方式 4、取余
by _hello_w_ @ 2021-12-17 19:11:46
终于找到了问题,哈哈,感觉真好
by ABCgfed @ 2024-07-12 13:22:48
6