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. Git环境的搭建及使用

    管理工具 1. Git环境的搭建 a.下载Git installer,地址:http://git-scm.com/downloads a1.参考文档地址:http://www.open-open.co ...

  2. 【poj1007】 DNA Sorting

    http://poj.org/problem?id=1007 (题目链接) 题意 给出m个字符串,将其按照逆序对个数递增输出. Solution 树状数组经典应用. 代码 // poj1007 #in ...

  3. (BZOJ4538)HNOI2016 网络

    HNOI2016 Day1 T2 网络 Description 一个简单的网络系统可以被描述成一棵无根树.每个节点为一个服务器.连接服务器与服务器的数据线则看做一条树边.两个服务器进行数据的交互时,数 ...

  4. rockmongo用法

    .简单查询 //xid=560870 and type=video { , "type": "video" } //查询数组中的数据 array( " ...

  5. WPF获取鼠标当前位置

    /// <summary> /// 设置鼠标的坐标 /// </summary> /// <param name="x">横坐标</par ...

  6. 新浪微博客户端(9)-实现版本新特性的ViewPager

    "DJNewFeatureViewController.m" #import "DJNewFeatureViewController.h" #define NE ...

  7. [Angularjs]asp.net mvc+angularjs+web api单页应用

    写在前面 最近的工作一直在弄一些h5的单页应用,然后嵌入到app的webview中.之前一直在用angularjs+html+ashx的一套东西.实在是玩腻了.然后就尝试通过asp.net mvc的方 ...

  8. 【分享】4款WiFi广告营销利器推荐

    随着WiFi的普及,相信大家已经发现很多公共场合连接WiFi的时候会要求登录,这个就是所谓的WiFi广告了. 什么是WiFi广告呢?(以下引用百科)       WiFi广告是目前WiFi营销的主要方 ...

  9. 微信用户量破6.5亿 首超移动QQ

    腾讯控股有限公司昨日公布了微信和WeChat合并月活跃用户量达到6.5亿,同比再涨39%.QQ在移动智能终端月活为6.39亿,同比增长18%,尽管势头也不错,但这是第一次,微信干掉了移动QQ! 201 ...

  10. cocos基础教程(10)纹理缓存技术

    Cocos2d通过调用CCTextureCache或者CCSpriteFrameCache来缓存精灵的纹理. 当这个精灵调用CCTextureCache 或 CCSpriteFrameCache的方法 ...