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. D&F学数据结构系列——红黑树

    红黑树 定义:一棵二叉查找树如果满足下面的红黑性质,则为一棵红黑树: 1)每个结点不是红的就是黑的 2)根结点是黑的 3)每个叶结点是黑的 4)如果一个结点是红的,它的两个儿子都是黑的(即不可能有两个 ...

  2. chmod命令详细用法

    指令名称 : chmod 使用权限 : 所有使用者 使用方式 : chmod [-cfvR] [--help] [--version] mode file... 说明 : Linux/Unix 的档案 ...

  3. 360 chrome 国际版能够隐藏用户保存的密码

    用360 chrome 国际版一段时间了,今天发现它一个优点:取消了浏览器保存的密码明文显示! 原生的chrome和枫树都会明文显示密码,360 chrome国际版则只显示保存了密码的域名和账户名.光 ...

  4. mysql小记--基础知识

    一.事务 事务是由一组SQL语句组成的逻辑处理单元. 事务的特征ACID,即原子性.一致性.隔离性和持久性. 原子性(Atomicity)事务作为整体执行,操作要么全部执行.要么全部不执行. 一致性( ...

  5. lintcode :sort letters by case字符大小写排序

    题目 字符大小写排序 给定一个只包含字母的字符串,按照先小写字母后大写字母的顺序进行排序. 您在真实的面试中是否遇到过这个题? Yes 样例 给出"abAcD",一个可能的答案为& ...

  6. *[codility]MaxDoubleSliceSum

    https://codility.com/demo/take-sample-test/max_double_slice_sum 两个最大子段和相拼接,从前和从后都扫一遍.注意其中一段可以为0.还有最后 ...

  7. 函数执行到return就结束了

    遇到return,函数就结束了,不会往下执行 测试: class User { String name; int age; boolean fun1(int i){ if(i==1){ return ...

  8. rhel-server-7.2-x86_64无法联网(VMware环境)

    vim /etc/sysconfig/network-script vim ifcfg-eno16777736 (编辑网卡名) 将ONBOOT=NO更改为YES (启动network服务时是否启用该网 ...

  9. OpenCV码源笔记——Decision Tree决策树

    来自OpenCV2.3.1 sample/c/mushroom.cpp 1.首先读入agaricus-lepiota.data的训练样本. 样本中第一项是e或p代表有毒或无毒的标志位:其他是特征,可以 ...

  10. showdialog()与show的区别

    showdialog就是显示有模式的窗体,showdialog后面的语句不会执行,直到显示的窗体被关闭. show就是无模式的窗体,显示窗体后不论窗体是否关闭都执行show后面的语句. ------- ...