C++ 50分求助!

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

头像危
by Rieman_sum @ 2023-05-24 20:37:27


```cpp #include <iostream> int main() { using namespace std; int a = 1 , b = 1; char v; while ( (v = cin.get() ) !'\n')a*=v'A'+1; while ( (v = cin.get() )!='\n')b*=v'A'+1; if (a % 47 == b % 47) cout << "GO"; else cout << "STAY"; return 0; } ``` //格式化一下,满分过
by zjy2205028602 @ 2023-05-24 20:37:48


你一定以为好心人帮你了对吧,其实不是
by Rieman_sum @ 2023-05-24 20:37:53


```cpp #include<bits/stdc++.h> //万能头推销 #define ll long long #define ull unsigned long long using namespace std; string a,b; int c=1,d=1; int main() { cin>>a>>b; int lena=a.length(); int lenb=b.length(); for(int i=0;i<lena;i++) { c*=a[i]-'@'; } for(int i=0;i<lenb;i++) { d*=b[i]-'@'; } c%=47; d%=47; if(c==d) cout<<"GO"; else cout<<"STAY"; return 0; } ``` 因为C/C++的数组下标从零开始
by xxxx100 @ 2023-05-24 20:47:14


从0开始循环就行
by dayday2012 @ 2023-07-11 20:16:35


|