USACO Your Ride Is Here 发表于 2016-03-30 | 分类于 USACO Training , Chapter 1 Getting started , Section 1.1 | Code123456789101112131415161718192021222324252627282930/*ID: wcr19961PROG: rideLANG: C++11*/#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long LL;const int maxn = 7;const int mod = 47;char a[maxn], b[maxn];int main() { freopen("ride.in", "r", stdin); freopen("ride.out", "w", stdout); scanf("%s%s", a, b); int len1 = int(strlen(a)), len2 = int(strlen(b)); int cnt1 = 1, cnt2 = 1; for (int i = 0; i < len1; ++i) { cnt1 *= a[i] - 'A' + 1; } for (int i = 0; i < len2; ++i) { cnt2 *= b[i] - 'A' + 1; } puts(cnt1 % mod == cnt2 % mod ? "GO" : "STAY"); return 0;}