标签:
熟悉一下USACO的提交方式。
很简单的一个题目,知道ascii码表就行。
/*{ ID:summer jy PROG:ride LANG:C++ }*/ #include <iostream> #include <algorithm> #include <cstdlib> #include <cstdio> #include <string> #include <cstring> #include <cmath> #include <ctime> #include <set> using namespace std; #define read() freopen("ride.in", "r", stdin) #define write() freopen("ride.out", "w", stdout) #define rep( i , a , b ) for ( int i = ( a ) ; i < ( b ) ; ++ i ) #define For( i , a , b ) for ( int i = ( a ) ; i <= ( b ) ; ++ i ) #define clr( a , x ) memset ( a , x , sizeof a ) #define cpy( a , x ) memcpy ( a , x , sizeof a ) #define _max(a,b) ((a>b)?(a):(b)) #define _min(a,b) ((a<b)?(a):(b)) #define LL long long const int maxNumber=10002; int gcd(int a,int b) { return b?gcd(b,a%b):a; } inline int lcm(int a,int b) { return a/gcd(a,b)*b; } int res(char *p) { int sum = 1; for (int i = 0; p[i]!=‘\0‘; ++i) { sum = sum*(p[i]-‘A‘+1); } sum %= 47; return sum; } int main() { read(); write(); char a[10]; char b[10]; scanf("%s%s",a,b); if (res(a)==res(b)) { printf("GO\n"); }else { printf("STAY\n"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/acmsummer/p/4335988.html