A water problem

Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 595    Accepted Submission(s): 308

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(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
 
Author
UESTC
 
Source
 
 
 
解析:大数取模。给你一个数,问这个数是否能同时整除73和137。而73和137均为素数,也就是判断这个数能否整除10001。
 
 
 
#include <cstdio>

const int MAXN = 10000000+5;
char s[MAXN]; int main()
{
int cn = 0;
while(~scanf("%s", s)){
int mod = 0;
for(int i = 0; s[i] != '\0'; ++i){
mod = (mod*10+s[i]-'0')%10001;
}
if(mod == 0)
printf("Case #%d: YES\n", ++cn);
else
printf("Case #%d: NO\n", ++cn);
}
return 0;
}

  

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 5832 A water problem 水题

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

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

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

  5. hdu 5443 The Water Problem

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Description In Land waterless, ...

  6. hdu 5443 The Water Problem 线段树

    The Water Problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...

  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 5443 The Water Problem (ST算法)

    题目链接:HDU 5443 Problem Description In Land waterless, water is a very limited resource. People always ...

  9. ACM学习历程—HDU 5443 The Water Problem(RMQ)(2015长春网赛1007题)

    Problem Description In Land waterless, water is a very limited resource. People always fight for the ...

随机推荐

  1. 【面试题015】链表中倒数第k个结点

    [面试题015]链表中倒数第k个结点    可以用两个指针,当第一个指针指向了第k个时候,第二个指针让他指向链表的第一个元素,然后这两个指针同时向后面移动, 当第一个指针移动到末尾的时候,第二个指针指 ...

  2. SSH Tunneling Explained

    转载: http://chamibuddhika.wordpress.com/2012/03/21/ssh-tunnelling-explained/ March 21, 2012 by Buddhi ...

  3. ZOJ 2724 Windows Message Queue (优先级队列,水题,自己动手写了个最小堆)

    #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm& ...

  4. hdu2010

    //很闲,刷水..... http://acm.hdu.edu.cn/showproblem.php?pid=2010 #include<iostream> #include<std ...

  5. [转]Win7下Eclipse中文字体太小

    最近新装了Win7,打开eclipse3.7中文字体很小,简直难以辨认.在网上搜索发现这是由于Eclipse 3.7 用的字体是 Consolas,显示中文的时候默认太小了.   解决方式有两种:一. ...

  6. 【PHPsocket编程专题(实战篇①)】php-socket通信演示

    建立Socket连接至少需要一对套接字,其中一个运行于客户端,称为ClientSocket ,另一个运行于服务器端,称为ServerSocket . 套接字之间的连接过程分为三个步骤:服务器监听,客户 ...

  7. MySQL错误代码大全【转载】

    B.1. 服务器错误代码和消息 服务器错误信息来自下述源文件: 错误消息信息列在share/errmsg.txt文件中."%d"和"%s"分别代表编号和字符串, ...

  8. C语言文件操作函数

    C语言文件操作函数大全 clearerr(清除文件流的错误旗标) 相关函数 feof表头文件 #include<stdio.h> 定义函数 void clearerr(FILE * str ...

  9. iOS 开发-- Runtime 1小时入门教程

    1小时让你知道什么是Objective-C Runtime,并对它有一定的基本了解,可以在开发过程中运用自如. 三.Objective-C Runtime到底是什么东西? 简而言之,Objective ...

  10. React测试Mixin

    1.test.jsx var randomNumberMixin = require("./randomNumberMixin.jsx"); describe("test ...