求指导 为什么60

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

@[NYHhh](/user/300749) 这样应该能AC。 ```cpp #include <iostream> #include <cstring> #include <string> using namespace std; int main() { string a,b; cin >> a >> b; int a1[7],b1[7]; int plus1 = 1, plus2 = 1; for(int i = 0;i < a.size();i++) { a1[i] = a[i] - 'A' + 1; plus1 *= a1[i]; } for(int i = 0;i < b.size();i++) { b1[i] = b[i] - 'A' + 1; plus2 *= b1[i]; } if(plus1 % 47 == plus2 % 47) cout << "GO"; else cout << "STAY"; return 0; } ```
by jwcub @ 2019-12-18 18:33:28


@[NYHhh](/user/300749) 问题在于```cin.get(a,7);```,每次读入的字符串长度不一定为7,所以会出现问题。
by jwcub @ 2019-12-18 18:34:39


您既然已经使用了```#include<string>```,不如使用```string```类型,比```char```数组好用。
by jwcub @ 2019-12-18 18:36:50


@[kevinhou](/user/75437) 它这不是两行数据嘛 第一行回车结束,输入应该没问题吧
by NYHhh @ 2019-12-18 20:10:31


|