#include <stdio.h>
void main ()
{
FILE *fin = fopen ("ride.in", "r");
FILE *fout = fopen ("ride.out", "w");
char comet[10],group[10]; //设两个字符数组分别保存彗星和团队名
int i,c=1,g=1;
fscanf (fin,"%s\n%s",comet,group);
for(i=0;comet[i];i++)
c*=(comet[i]-'A'+1); //求各个字符对应字母的乘积
for(i=0;group[i];i++)
g*=(group[i]-'A'+1);
fprintf (fout,c%47==g%47?"GO\n":"STAY\n"); //若两数模47同余则输出GO,否则输出STAY
exit (0);
}
这题很简单,但第一次提交没通过,原因居然是GO写成了Go。这类小问题一定要注意,不能栽在细节上。
Your Ride Is Here
最新推荐文章于 2020-12-02 22:05:35 发布