A water problem

题目连接:

http://acm.hdu.edu.cn/showproblem.php?pid=5832

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(0≤N), 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

Hint

题意

给你一个数,问你这个数是否能够整除137和73

题解:

这两个数互质,其实就是问你能否整除10001

这个直接扫一遍就好了。

用string可能会TLE,所以老老实实用char就好了

代码

#include<bits/stdc++.h>
using namespace std; char s[10000005];
int cas = 0;
int main(){
while(scanf("%s",s)!=EOF){
int mod1 = 0;int len=strlen(s);
for(int i=0;i<len;i++){
mod1=(mod1*10+s[i]-'0')%10001;
}
if(mod1==0)printf("Case #%d: YES\n",++cas);
else printf("Case #%d: NO\n",++cas);
}
}

HDU 5832 A water problem 水题的更多相关文章

  1. HDU 5832 A water problem(某水题)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  2. HDU 5832 A water problem (带坑水题)

    A water problem 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...

  3. hdu-5867 Water problem(水题)

    题目链接: Water problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Othe ...

  4. HDU 5832 A water problem

    A water problem Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

  5. HDU 5832 A water problem (水题,大数)

    题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...

  6. HDU 5538 L - House Building 水题

    L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  7. hdu 5443 The Water Problem(长春网络赛——暴力)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Time Limit: 1500/1000 MS (Java ...

  8. hdu 1005:Number Sequence(水题)

    Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  9. hdu 1018:Big Number(水题)

    Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

随机推荐

  1. BFS搜索算法应用_Codevs 1004 四子连棋

    #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <algorithm> #include <cs ...

  2. php拾遗: 类型约束

    突然间什么都不想干,感觉就像来大姨夫一样..但是又不能断了每个工作日都写博客的习惯..所以今天水一下吧. PHP用了快2年了,但是这东西竟然第一次看到,突然间,觉得自己有掉回战五渣的行列了.翻开官方文 ...

  3. IOS 与 PHP 通信加密,使用AES 128 CBC no padding

    这个网上的资料真实浩如烟海,但是真正有价值的屈指可数 自己尝试了一天多,终于还是搞定了. 再次要感谢网上的前辈么. 比如下面这个关于php和java端的实现: http://my.oschina.ne ...

  4. laravel一个页面两个表格分页处理

    关键是看懂laravel自带的 paginate() 方法. 在Builder.php文件(项目名称/laravel/vendor/laravel/framework/src/Illuminate/D ...

  5. MFC里ON_COMMAND_RANGE消息映射的ID问题

    今天在工作中遇到一个问题,一个动态菜单,每个菜单的菜单项ID是我自己定义的,定义如下: #define IDM_SEARCHRECORD0 222240 #define IDM_SEARCHRECOR ...

  6. Winform/WPF Clipboard之剪切复制粘贴

    Winform // <summary> /// 复制或剪切文件至剪贴板(方法) /// </summary> /// <param name="files&q ...

  7. JavaScript——创建对象

    <script type="text/javascript"> //声明变量的首字母是小写 //1.对象字面量 /*var person = { name:" ...

  8. sys和os模块

    一 sys 用于python解释器相关的操作 #!/usr/bin/env python # coding=utf-8 import time import sys def view_bar(num, ...

  9. Ubuntu下SSH安装

    step: 1.输入命令: sudo apt-get install openssh-server 2.验证sshserver是否启动了,以下两条命令均可 ps -e | grep ssh netst ...

  10. java实战

    1.http://learning.happymmall.com/ http://www.happymmall.com/index.html  前台官网 http://test.happymmall. ...