求助为什么只有50分

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

读题: ```cpp 如果小组的数字 mod 47 等于彗星的数字 mod 47,你就得告诉这个小组需要准备好被带走! (记住“a mod b”是a除以b的余数;34 mod 10等于4) ``` ### 你的" %47 "呢?
by 反手一只MJJ @ 2019-10-14 19:32:55


@[反手一只MJJ](/space/show?uid=134593) 抱歉,是我太不仔细了,感谢。
by ebubu @ 2019-10-14 19:36:52


@[反手一只MJJ](/space/show?uid=134593) 还是 50分。。。
by ebubu @ 2019-10-14 19:40:52


```cpp #include <iostream> #include<string> using namespace std; int main() { int teamnum=0; int ufonum=0; string team; string ufo; cin >> team; cin >> ufo; int one = team.size(); int two = ufo.size(); for(int a=0;a<one;a++) { teamnum *= ((int)team[a] - 64); } for (int b = 0; b < two; b++) { ufonum *= ((int)team[b] - 64); } int three = (teamnum % 47); int four = (ufonum % 47); if (three ==four ) { cout << "GO"; } else { cout << "STAY"; } } ```
by ebubu @ 2019-10-14 19:41:06


@[4833120nm](/space/show?uid=255850) 吃完饭我帮你看
by 荣巴 @ 2019-10-15 15:49:03


我是上回给你isbn那道题的代码的蒟蒻
by 荣巴 @ 2019-10-15 15:49:33


@[荣巴](/space/show?uid=202172) 我还记得你呢,代码后来我看懂了,真是谢谢了,当输入一些数据时,会出现debug,不知道为什么
by ebubu @ 2019-10-16 07:28:40


@[4833120nm](/space/show?uid=255850) 可能每个编译器都不一样吧
by 荣巴 @ 2019-10-16 21:53:14


#include<iostream> #include<cstring> using namespace std; int main() { char a[7],b[7]; int i,j,s1=1,s2=1; cin>>a>>b; for(i=0;i<strlen(a);i++) { s1=s1*(a[i]-64); } s1=s1%47; for(i=0;i<strlen(b);i++) { s2=s2*(b[i]-64); } s2=s2%47; if(s1==s2) cout<<"GO"<<endl; else cout<<"STAY"<<endl; return 0; }
by 荣巴 @ 2019-10-16 21:54:07


你的代码好像少了个求余47
by 荣巴 @ 2019-10-16 21:54:56


| 下一页