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. 如何使用lessc编译.less文件

    LESS :一种动态样式语言. LESS 将 CSS 赋予了动态语言的特性,如 变量, 继承, 运算, 函数. LESS 既可以在 客户端 上运行 (支持IE 6+, Webkit, Firefox) ...

  2. CODEVS1995 || TYVJ1863 黑魔法师之门

    P1863 [Poetize I]黑魔法师之门 时间: 1000ms / 空间: 131072KiB / Java类名: Main 背景 经过了16个工作日的紧张忙碌,未来的人类终于收集到了足够的能源 ...

  3. openSSL命令、PKI、CA、SSL证书原理

    相关学习资料 http://baike.baidu.com/view/7615.htm?fr=aladdin http://www.ibm.com/developerworks/cn/security ...

  4. php抓取页面的几种方式

    在做一些天气预报或者RSS订阅的程序时,往往 需要抓取非本地文件,一般情况下都是利用php模拟浏览器的访问,通过http请求访问url地址, 然后得到html源代码或者xml数据,得到数据我们不能直接 ...

  5. 学习 easyui 之一:easyloader 分析与使用

    http://www.cnblogs.com/haogj/archive/2013/04/22/3036685.html 使用脚本库总要加载一大堆的样式表和脚本文件,在 easyui 中,除了可以使用 ...

  6. Matlab中的括号()[]{}

    Matlab中的括号()[]{} Matlab中经常会用到括号去引用某Array或者是cell的内容,但三者有什么具体区别呢?[ ] 中括号用来构建向量(Vectors)或者是矩阵(Matrices) ...

  7. iOS Application Life Cycle 应用程序生命周期

    应用程序的状态 IOS的应用程序一共有5种状态. Not running(未运行):程序未启动 Inactive(未激活):其他两个状态切换时出现的短暂状态.唯一在此状态停留时间比较长的情况是:当用户 ...

  8. RHEL6.4记录一次添加一块新分区的操作

    首先看了下挂载点及目录 fdisk /dev/sda [root@box ~]# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. ...

  9. 将DataTable导出为Excel C#

    /// <summary> /// 导出Excel /// </summary> /// <param name="dt">DataTable& ...

  10. Android Bitmap 全面解析(四)图片处理效果对比 ...

    对比对象: UIL Volley 官方教程中的方法(此系列教程一里介绍的,ImageLoader的处理方法和官方的差不多) -------------------------------------- ...