GoodLuckCat @ 2023-08-18 10:18:03
#include<iostream>
using namespace std;
int main(){char a,c;int b;cin>>b;while(cin>>a){c=a+b;if(c>'z')c-=26;cout<<c;}}
验证码mdsx
寄
by lujunxuan123 @ 2023-08-18 10:22:23
@Huyuhao0215 c-=26写成x%=26
by lujunxuan123 @ 2023-08-18 10:22:55
n可能很大
by GoodLuckCat @ 2023-08-18 10:30:19
应该是c%=26
吧
by GoodLuckCat @ 2023-08-18 10:31:30
但是还过不去啊
https://www.luogu.com.cn/record/121527530
#include<iostream>
using namespace std;
int main(){char a,c;int b;cin>>b;while(cin>>a){c=a+b;if(c>'z')c%=26;cout<<c;}}
by zbyzby666 @ 2023-08-18 10:33:23
看不懂
by Starry_dream @ 2023-08-18 10:50:09
我们考试考过啊,你忘了吗
by GoodLuckCat @ 2023-08-18 10:55:32
真忘了
by Starry_dream @ 2023-08-18 10:56:02
用字符串做
by GoodLuckCat @ 2023-08-18 11:03:25
下载数据过了
by Starry_dream @ 2023-08-18 11:13:10
AC了(不要Ctrl+c哦)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string a;
cin>>a;
for(int i=0;i<a.size();i++){
if(a[i]+n<='z')
{
a[i]+=n;
}
else
{
a[i]=a[i]+n-26;
}
}
cout<<a;
return 0;
}