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. 【bzoj1050】 旅行comf

    http://www.lydsy.com/JudgeOnline/problem.php?id=1050 (题目链接) 题意 给出一个无向图,求图中两点间某条路径使得最大权值除以最小权值的值最小 So ...

  2. C#文件复制功能

    目的是将用户自定义文件复制到指定文件夹并且能查看该文件,下面是个人做的源码: sing System; using System.Collections.Generic; using System.C ...

  3. 用word写博客

    都知道word的编辑功能强大,那如何用word写博客呢? 以博客园为例 1.写好word文档后,文件->共享->发送至博客,或者新建博客模板 2. 再博客的界面点击管理账户,新建账户,如果 ...

  4. 嵌入式实时操作系统μCOS原理与实践+事件部分代码

    //事件等待表的初始化函数:pevent表示事件控制块的指针#if (OS_EVENT_EN)void  OS_EventWaitListInit (OS_EVENT *pevent){    INT ...

  5. Boost的状态机库教程(1)

    介绍 Boost状态机库一个应用程序框架,你可以用它将UML状态图快速的转换为可执行的c++代码,而不需要任何的代码生成器.它支持几乎所有的UML特征,可以直接了当的转换,并且转换后的c++代码就像对 ...

  6. Lua函数之二

    Lua函数之二 Lua中函数的两个重要特性: 1.函数和其他类型(如number.string)一样,可以存放在变量中,也可以存放在table中,可以作为函数的参数,还可以作为函数的返回值. 2.嵌套 ...

  7. MyBatis 用户表记录数查询

    搭建MyBatis开发环境,实现用户表记录数查询 1.在MyEclipse中创建工程,导入MyBatis的jar包

  8. IHttpModule在webconfig中的注册

    在asp.net中,提供了两种方式用来解决获取由asp.net服务器创建和维护的HttpApplication对象,方便注册HttpApplication对象的事件处理.这两种方式为:IHtpModu ...

  9. R与JAVA的整合

    R是统计计算的强大工具,而JAVA是做应用系统的主流语言,两者天然具有整合的需要.关于整合,一方面,R中可以创建JAVA对象调用JAVA方法,另一方面,JAVA中可以转换R的数据类型调用R的函数,互相 ...

  10. URAL 1936 Roshambo 题解

    http://acm.timus.ru/problem.aspx?space=1&num=1936 F - Roshambo Time Limit:1000MS Memory Limit:65 ...