这样比较简单
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a[9],b[9];
int i,h,k,s=1,t=1;
gets(a);
gets(b);
for(i=0;i<strlen(a);i++)
{
h=a[i]-64;
s*=h;
}
s%=47;
for(i=0;i<strlen(b);i++)
{
h=b[i]-64;
t*=h;
}
t%=47;
if(s==t) cout<<"GO";
else cout<<"STAY";
return 0;
}
by 基础不牢 @ 2018-11-21 13:12:35
// luogu-judger-enable-o2
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a=1,b=1;
char s;
while ( (s = cin.get() ) != '\n') a *= s - 'A' + 1;
while ( (s = cin.get() ) != '\n') b *= s - 'A' + 1;
if (a % 47 == b % 47) cout << "GO";
else cout << "STAY";
return 0;
}
by 斯蒂芬王 @ 2018-11-21 13:31:23
@[斯蒂芬王](/space/show?uid=85793) 啥意思?
by Achiles @ 2018-11-28 21:52:15