不用啊,cin可以以回车结束的
by _____QWQ_____ @ 2023-12-06 18:06:36
输入n之后就自动进入字符串s的输入了
by _____QWQ_____ @ 2023-12-06 18:07:13
@[smallpeople](/user/654763)
```cpp
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
string s;
cin>>n;
char c=getchar();
c=getchar();
getline(cin,s);
for(int i = 0;i < s.size();i ++)
{
int ss = s[i] + n;
if(ss > 'z')ss -= 26;
s[i] = ss;
}
cout<<s;
return 0;
}
```
by sdyzpf @ 2023-12-06 18:26:18
@[smallpeople](/user/654763) 这题数据好像有点问题
by sdyzpf @ 2023-12-06 18:28:10
@[smallpeople](/user/654763) 要吞两次回车
by sdyzpf @ 2023-12-06 18:28:35
@[smallpeople](/user/654763) 代码有个问题,n如果比较大的话,ss可能要减不止一次26
```cpp
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
string s;
cin>>n;
char c=getchar();
c=getchar();
getline(cin,s);
for(int i = 0;i < s.size();i ++)
{
int ss = s[i] + n;
while(ss > 'z')ss -= 26;
s[i] = ss;
}
cout<<s;
return 0;
}
```
by sdyzpf @ 2023-12-06 18:31:22
@[smallpeople](/user/654763) 正常题目只要吞一次换行就够了,是这题数据的问题,我跟管理反馈下
by sdyzpf @ 2023-12-06 18:52:24
吞回车可以用Ctrl+Z解
by xinxin88_0v0 @ 2023-12-06 19:15:58
@[sdyzpf](/user/174477) 谢谢,懂啦!
by smallpeople @ 2023-12-07 18:51:37