zys180 @ 2022-08-30 17:17:56
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,m=0,time=0;
cin>>n;
string a;
cin>>a;
for(int i=0;i<=a.size();i++){
a[i]=a[i]+n;
if(a[i]>122){
a[i]-=26;
}
}
cout<<a;
return 0;
}
第3,4点WA了
by zcb123 @ 2022-08-30 18:37:55
样例
26 qwertyuiopasdfghjklzxcvbnm
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
string a;
cin>>a;
n %= 26;
n -= 26;
for(int i=0;i<a.size();i++){
a[i]=a[i]+n;
if(a[i] < 'a'){
a[i]+=26;
}
}
cout<<a;
return 0;
}
by zys180 @ 2022-08-30 19:01:31
我这边用自己代码已经过了,谢谢大佬