为什么是0分,测试没问题呀!

P1914 小书童——凯撒密码

cyctemp @ 2018-04-22 16:42:54

include<stdio.h>

include<iostream>

using namespace std; char a[55],tep; int main() { int n,m=1; cin>>n; tep=getchar(); while((a[m++]=getchar())!='\n'); for(int i=1;i<=m-2;i++) {a[i]=((a[i]-'a')+n)%26+'a';cout<<a[i];} return 0; }


by cyctemp @ 2018-04-22 16:57:42

#include<stdio.h>
#include<iostream>
using namespace std;
char a[55],tep; 
int main()
{
    int n,m=1;
    cin>>n;
    tep=getchar();
    while((a[m++]=getchar())!='\n');
    for(int i=1;i<=m-2;i++)
    {a[i]=((a[i]-'a')+n)%26+'a';cout<<a[i];}
    return 0;
}                                                        

by cyctemp @ 2018-04-22 16:59:38

全部是:Too many or too few lines. 得分0


by UKE自动稽 @ 2018-04-22 17:24:14

@cyctemp 你不是过了吗?


by cyctemp @ 2018-04-22 17:31:54

换了方法才过的,这种测试全对,一上机就全零分了,郁闷中!


by Tony_Peter @ 2018-08-01 10:22:17

所以最后是怎么过的?我的情况也差不多,全是WA,求赐教。```cpp

include<bits/stdc++.h>

using namespace std; char c[51]; int main(){ int n,k=1; cin>>n; getchar(); gets(c); for(int i=0;i<strlen(c);i++) { c[i]=(c[i]-'a'+n)%26+'a'; cout<<c[i]; } cout<<endl; return 0; }


|