以前的账号忘记了,只能从头了。
入门题不解释,就是sumg和sumc初始值置1不能置0。开始享用一个循环计算出sumg和sumc,其实两个数组最大程度为6,节省不了什么时间。
/*ID:Moment1991
PROG:ride
LANG:C++
*/
#include <iostream>
#include <fstream>
using namespace std; int main()
{
ifstream cin("ride.in");
ofstream cout("ride.out");
char comet[];
char group[]; cin >> comet;
cin >> group; int i = ;
long int sumc = ,sumg = ;
while(comet[i] != '\0')
{
sumc = sumc * (comet[i] - 'A' + );
i++;
}
i = ;
while(group[i] != '\0')
{
sumg = sumg * (group[i] - 'A' + );
i++;
}
if(sumg% == sumc%)
cout <<"GO"<<endl;
else
cout <<"STAY"<<endl;
}