USACO:PROB Your Ride Is Here

没什么好说的

/*
ID: Jang Lawrence
PROG: ride
LANG: C++
*/
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int res(char *p)
{
    int ans=1;
    for(int i=0;p[i]!='\0';++i)
    ans=(ans*(p[i]-'A'+1))%47;
    return ans;
}
int main()
{
   freopen("ride.in","r",stdin);
   freopen("ride.out","w",stdout);
  char a[2][1111];
  scanf("%s%s",a[0],a[1]);
  printf("%s\n",res(a[0])==res(a[1])?"GO":"STAY");
    return 0;
}


你可能感兴趣的:(USACO:PROB Your Ride Is Here)