A water problem

Problem Description
Two planets named Haha and Xixi in the universe and they were created with the universe beginning.

There is 73 days in Xixi a year and 137 days in Haha a year. 

Now you know the days N after Big Bang, you need to answer whether it is the first day in a year about the two planets.
 

 

Input
There are several test cases(about 5 huge test cases).

For each test, we have a line with an only integer N(0N), the length of N is up to 10000000.
 

 

Output
For the i-th test case, output Case #i: , then output "YES" or "NO" for the answer.
 

 

Sample Input
10001
0
333
 

 

Sample Output
Case #1: YES
Case #2: YES
Case #3: NO
大整数取余。对10001取余,10001是73和137的最小公倍数。
 1 #include <cstring>
 2 #include <cstdio>
 3 #include <iostream>
 4 #include <algorithm>
 5 #include <cmath>
 6 #include <stack>
 7 #include <vector>
 8 #include <queue>
 9 #include <cmath>
10 using namespace std;
11 #define N 10500000
12 typedef long long LL;
13 int a[N],b[N];
14 int len;
15 
16 int main()
17 {
18 
19 
20     int i=1;
21     char str[N];
22     while(scanf("%s", str) != EOF)
23     {
24 
25         int d = 10001;
26         int ans = 0;
27         for(int j = 0; str[j]; j++)
28             ans = (ans * 10 + (str[j] - '0') % d) % d;
29 
30 
31         if( ans == 0)
32             printf("Case #%d: YES\n", i++);
33         else
34             printf("Case #%d: NO\n", i++);
35     }
36     return 0;
37 }

 

 
posted @ 2016-08-14 13:16  biu~biu~biu~  阅读(571)  评论(0编辑  收藏  举报