[USACO 1.1.1]你要乘坐的飞碟在这里

从简单的开始

 

地址:http://hustoj.sinaapp.com/problem.php?id=1816

 

很简单,模拟题,注意一下范围即可,不过千万不能用fflush(stdin),要不然报错,这个可能和OJ本身有关

 

 1 #include <stdio.h>
 2 
 3 int main()
 4 {
 5     char in;
 6     long long star=1;
 7     long long group=1;
 8     in=getchar();
 9     while(in>='A' && in<='Z')
10     {
11         star=star*(in-'A'+1);
12         in=getchar();
13     }
14     star=star%47;
15     in=getchar();
16     while(in>='A' && in<='Z')
17     {
18         group=group*(in-'A'+1);
19         in=getchar();
20     }
21     group=group%47;
22     if(group==star) printf("GO\n");
23     else printf("STAY\n");
24     return 0;
25 }

 

posted @ 2013-01-14 23:29  tjsuhst  阅读(280)  评论(0)    收藏  举报