thliup @ 2023-12-11 21:32:06
#include<iostream>
using namespace std;
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<stdbool.h>
int main() { 、
int n;
cin >> n;
string s;
cin >> s;
int len = s.length();
for (int i = 0; i <len; i++) {
s[i] =s[i]+n;
while(s[i] > 122)
s[i] = 96 + s[i] - 122;
}
cout << s;
}
by HappyACALL @ 2023-12-18 19:51:00
哪位好人知道了,d我一下,我也觉得他这个没毛病
by D1anaStrawb3rry @ 2023-12-19 22:54:14
@huangshuwen @thliup 直接对这个s[i]做加法的话 假如你一开始就很大比如是122,只要n超过5,你这个数就爆出了ascii的范围了,自然就会乱码
by thliup @ 2023-12-20 18:04:26
@D1anaStrawb3rry 嗯嗯,了解了,谢谢
by thliup @ 2023-12-20 18:05:16
@huangshuwen 不能大于128在ascll中