A water problem

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

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
 
Recommend
wange2014   |   We have carefully selected several
similar problems for you:  5842 5841 5840 5839 5838 
 
 
解题思路:判断输入的数能否被10001整除,因为10001是73和137的最小公倍数。
  只要模拟除法,看最后的余数就可以。
  因为判断位数太多,所以也不能用java大数做,不然会内存超限。
  感觉之前做题给做傻了,一见到大数就想用java,一看别人说的题意就理解了,但自己看就是看不懂题意。
代码:
 #include <iostream>
#include <cstdio>
#include <cstring> using namespace std; char s[]; int main()
{
int z=;
int ans=;
int d=;
int len;
while(scanf("%s",s)!=EOF){
ans=;
len=strlen(s);
for(int i=;i<len;i++){
ans=((ans*+(s[i]-''))%d)%d;
}
if(ans==){
printf("Case #%d: YES\n",z++);
}else{
printf("Case #%d: NO\n",z++);
}
}
return ;
}

hdu5832 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 5443 The Water Problem

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

  3. HDU 5867 Water problem (模拟)

    Water problem 题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5867 Description If the numbers ...

  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 (带坑水题)

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

  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-4974 A simple water problem

    http://acm.hdu.edu.cn/showproblem.php?pid=4974 话说是签到题,我也不懂什么是签到题. A simple water problem Time Limit: ...

  8. The Water Problem(排序)

    The Water Problem Time Limit: 1500/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Othe ...

  9. HDU 4974 A simple water problem(贪心)

    HDU 4974 A simple water problem pid=4974" target="_blank" style="">题目链接 ...

随机推荐

  1. 通知栏Notification的学习

    转:http://blog.csdn.net/yczz/article/details/28416893 在android的应用层中,涉及到很多应用框架,例如:Service框架,Activity管理 ...

  2. POJ3233Matrix Power Series(十大矩阵问题之三 + 二分+矩阵快速幂)

    http://poj.org/problem?id=3233 Matrix Power Series Time Limit: 3000MS   Memory Limit: 131072K Total ...

  3. U盘中的autorun.inf

    怎么删除u盘里的autorun.inf 如果U盘中毒,刚插进机子时按住SHIFT五秒,这样就可以跳过预读,这样防止了预读时把病毒感染到机子上,在U盘盘符上点右键,看看有没有“Auto”选项: 1.如果 ...

  4. 转载大神的检测网站重定向的python脚本

    #!/usr/bin/env python #coding=utf8 import sys import requests def check_for_redirects(url): try: r = ...

  5. mySQL 增量备份方案(转)

    1.在 /etc/my.cnf 下面设置开启bin-log 编辑 vim /etc/my.cnf [mysqld] binlog_format       = MIXED                ...

  6. Mongodb For C# "Query" 对象常用的方法

    Query.All("name", "a", "b");//通过多个元素来匹配数组 Query.In("name", & ...

  7. Oracle 客户端配置

    nstantclient-basic-nt-12.1.0.1.0\instantclient_12_1下面新建NETWORK文件夹,NETWORK下新建ADMIN文件夹,ADMIN下新建tnsname ...

  8. linux在安装jdk时报错

    用脚本执行jdk时下面的错误 can not initialize UI, Running in headless mode, No X11 DISPLAY variable was set, but ...

  9. oracle数据库备份与还原

    一  关于expdp和impdp     使用EXPDP和IMPDP时应该注意的事项:EXP和IMP是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用.EXPDP和IMPDP是服务端的工具程 ...

  10. The Dragon of Loowater

      The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into ...