码迷,mamicode.com
首页 > 其他好文 > 详细

A water problem

时间:2016-08-14 14:25:26      阅读:232      评论:0      收藏:0      [点我收藏+]

标签:

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 }

 

 

A water problem

标签:

原文地址:http://www.cnblogs.com/biu-biu-biu-/p/5770033.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!