洛谷 P1200 [USACO1.1]你的飞碟在这儿Your Ride Is Here
你的飞碟在这儿
难度:☆
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;
}
唯愿,青春不辜负梦想,未来星辰闪耀