P1200 USACO1.1 你的飞碟在这儿

数学+字符串问题 水题 直接上代码~

AC代码:

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 typedef long long ll;
 4 typedef unsigned long long ull;
 5 
 6 namespace io {
 7     const int SIZE = 1e7 + 10;
 8     char inbuff[SIZE];
 9     char *l, *r;
10     inline void init() {
11         l = inbuff;
12         r = inbuff + fread(inbuff, 1, SIZE, stdin);
13     }
14     inline char gc() {
15         if (l == r) init();
16         return (l != r) ? *(l++) : EOF;
17     }
18     void read(int &x) {
19         x = 0; char ch = gc();
20         while(!isdigit(ch)) ch = gc();
21         while(isdigit(ch)) x = x * 10 + ch - '0', ch = gc();
22     }
23 } using io::read;
24 
25 int main(){
26     char a[7], b[7];
27     cin>>a>>b;
28     int sum1 = 1, sum2 = 1;
29     for (int i = 0; i < strlen(a); i++)
30         sum1 *= (a[i] - 'A' + 1);
31     for (int i = 0; i < strlen(b); i++)
32         sum2 *= (b[i] - 'A' + 1);
33     if (sum1 % 47 == sum2 % 47)
34         cout<<"GO"<<endl;
35     else cout<<"STAY"<<endl;
36     return 0;
37 }

 

转载于:https://www.cnblogs.com/Misuchii/p/10909747.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值