下载测试点对了,但还是WA

P1200 [USACO1.1] 你的飞碟在这儿 Your Ride Is Here

``` for (int i=0;i<lena;i++) ``` 你可以想想 字符串是从0开始的 如果他说n长度那结尾应该是n-1 n-1-0+1=n
by ajahjahah @ 2022-04-17 13:56:50


@[Expectation](/user/706255) [The AC code](https://www.luogu.com.cn/record/74111013) ``` #include<cstdio> #include<cstring> #include<iostream> using namespace std; char a[11],b[11]; int main() { int suma=1,sumb=1; cin.getline(a,11); cin.getline(b,11); int lena=strlen(a); int lenb=strlen(b); for (int i=0;i<lena;i++) { suma*=(a[i]-64); } for (int i=0;i<lenb;i++) { sumb*=(b[i]-64); } if (suma%47==sumb%47) { printf("GO"); } else { printf("STAY"); } return 0; } ``` 原因:字符串下标从$0$开始。 上楼更加详细,听上楼的(帮忙@下
by coldy_rainy @ 2022-04-17 14:21:48


@[lao_ba](/user/357378) 谢谢
by Expectation @ 2022-04-17 14:48:57


@[penhaochen](/user/526755) 谢谢
by Expectation @ 2022-04-17 14:49:19


|