你的飞碟在这儿
难度:☆
Code:
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int jisuan(char a[]);
int main() {
char a[7] = {};
char b[7] = {};
cin>>a;
cin>>b;
int C = jisuan(a);
int D = jisuan(b);
if(C == D)
cout<<"GO"<<endl;
else
cout<<"STAY"<<endl;
return 0;
}
int jisuan(char a[])
{ int sum = 1;
for(int i = 0; i < strlen(a); i++) {
if(a[i] == 'A')
sum = sum % 47;
else
sum = sum * (a[i] - 'A' + 1) % 47;
}
return sum;
}