求助了,0分。。。

P1914 小书童——凯撒密码

#include<bits/stdc++.h> using namespace std; int main() { string a; int n; cin>>n>>a; for(int i=0;i<a.size();i++) { a[i]=(a[i]-'a'+n)%26+'a'; } cout<<a; }
by 洛天依_ @ 2019-01-26 21:44:04


```cpp #include<bits/stdc++.h> using namespace std; int main() { string a; int n; cin>>n>>a; for(int i=0;i<a.size();i++) { a[i]=(a[i]-'a'+n)%26+'a'; } cout<<a; } ```
by 洛天依_ @ 2019-01-26 21:45:55


你的“for(i=0;code[i];i++)”这一行应该是无限循环
by 洛天依_ @ 2019-01-26 21:47:55


@[洛天依_](/space/show?uid=125268) 谢谢你的代码,不过我还是想知道我错在哪了==
by Catmint @ 2019-01-26 21:49:02


@[洛天依_](/space/show?uid=125268) 那也应该是TLE啊= =全是WA
by Catmint @ 2019-01-26 21:50:03


@[Catmint](/space/show?uid=141881) 你这样无限输出当然会WA
by 洛天依_ @ 2019-01-26 21:58:51


``` for(i=0;code[i]!='\0';i++) ```@[洛天依_](/space/show?uid=125268)
by Catmint @ 2019-01-26 22:05:10


@[洛天依_](/space/show?uid=125268) 还是0
by Catmint @ 2019-01-26 22:05:27


@[Catmint](/space/show?uid=141881) 定义在main函数内的数组,初始值都是玄学,你要么MEMSET赋值,要么改为(code[i]>='a'&&code[i]<='z')
by 洛天依_ @ 2019-01-26 22:08:42


@[洛天依_](/space/show?uid=125268) 那为什么我测试点1过了为什么没分= =这是啥情况
by Catmint @ 2019-01-26 22:14:24


| 下一页