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. 求二叉树中第K层结点的个数

    一,问题描述 构建一棵二叉树(不一定是二叉查找树),求出该二叉树中第K层中的结点个数(根结点为第0层) 二,二叉树的构建 定义一个BinaryTree类来表示二叉树,二叉树BinaryTree 又是由 ...

  2. ASP.NET批量下载文件

    一.实现步骤 在用户操作界面,由用户选择需要下载的文件,系统根据所选文件,在服务器上创建用于存储所选文件的临时文件夹,将所选文件拷贝至临时文件夹.然后调用 RAR程序,对临时文件夹进行压缩,然后输出到 ...

  3. es6笔记(5)Map数据结构

    概要 字典是用来存储不重复key的Hash结构.不同于集合(Set)的一点,字典使用的是[key,value]的形式来存储数据. JavaScript的对象(Object:{})只能用字符串当做key ...

  4. 第12月第14天 sfml cmake

    1. cd Desktop/mycode/ ls mkdir sfml03 cd sfml03 ls vi main.cpp vi config.h vi CMakeLists.txt ls pwd ...

  5. vsftp服务器部署

    环境:CentOS 6.6 目标:个人虚机部署vsftp服务器,供测试使用. 说明:步骤已改写为脚本,直接添加用户与对应的密码列表,调用函数名即可 ########################## ...

  6. 洛谷 P1609 最小回文数 题解

    这题其实并不难,重点在你对回文数的了解,根本就不需要高精度. 打个比方: 对于一个形如 ABCDEFGH 的整数 有且仅有一个比它大的最小回文数 有且仅有一个比它小的最大回文数 而整数 ABCDDCB ...

  7. ASP .Net Core系统部署到SUSE Linux Enterprise Server 12 SP3 64 具体方案

    .Net Core 部署到 SUSE Linux Enterprise Server 12 SP3 64 位中的步骤 1.安装工具 1.apache 2..Net Core(dotnet-sdk-2. ...

  8. 织梦任意页面调用{dede:field.content/}的方法

    过滤掉所有的html代码,只显示文字,具体的ID自己更改. 代码如下: {dede:sql sql='Select content from dede_arctype where id=1'} [fi ...

  9. 方法调用---springMVC中调用controller的方法

    我们有一个路由StudentController,里面有一个方法count().如果要在另外一个GradeController中调用count()方法有2种方式: 因为StudentControlle ...

  10. Codeforces Round #475 (Div. 2) D. Destruction of a Tree

    题意:给你一棵树, 只能删度数为偶数的点, 问你能不能将整个图删完, 如果能输入删除的顺序. 思路:对于一棵树来说, 如果里面的点的个数是偶数个则肯定不可能, 偶数个点有奇数条边,而你每次删只能删偶数 ...