A water problem

题目链接:

http://acm.hdu.edu.cn/showproblem.php?pid=5832

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

Source


2016中国大学生程序设计竞赛 - 网络选拔赛


##题意:

判断一个长度最多为1e7的数串是否同时模73和137为0.


##题解:

第一眼反应是水题,赶紧用java打一发. 结果MLE...
然后用getchar逐个读入判断. TLE.
才反应过来要用gets或scanf读入再处理,直到第四发才过...

比赛中java一定要慎用,如果能看别人的提交信息,先看看用java有没有过的.


##代码:
``` cpp
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define LL long long
#define eps 1e-8
#define maxn 10001000
#define mod 1000000007
#define inf 0x3f3f3f3f
#define mid(a,b) ((a+b)>>1)
#define IN freopen("in.txt","r",stdin);
using namespace std;

char str[maxn];

int main(int argc, char const *argv[])

{

//IN;

int ca = 1;
while(gets(str))
{
int num = 0;
int sz = strlen(str); for(int i=0; i<sz; i++) {
num = (num*10 + str[i] - '0') % 10001;
} if(num) printf("Case #%d: NO\n", ca++);
else printf("Case #%d: YES\n", ca++);
} 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 Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

  4. HDU 5832 A water problem (水题,大数)

    题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...

  5. CODE FESTIVAL 2017 qual B B - Problem Set【水题,stl map】

    CODE FESTIVAL 2017 qual B B - Problem Set 确实水题,但当时没想到map,用sort后逐个比较解决的,感觉麻烦些,虽然效率高很多.map确实好写点. 用map: ...

  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 Description In Land waterless, ...

  8. hdu 5443 The Water Problem(长春网络赛——暴力)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Time Limit: 1500/1000 MS (Java ...

  9. hdu 2393:Higher Math(计算几何,水题)

    Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

随机推荐

  1. maven项目配置Jetty服务器

    <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin ...

  2. 【问底】徐汉彬:Web系统大规模并发——电商秒杀与抢购

    [导读]徐汉彬曾在阿里巴巴和腾讯从事4年多的技术研发工作,负责过日请求量过亿的Web系统升级与重构,目前在小满科技创业,从事SaaS服务技术建设. 电商的秒杀和抢购,对我们来说,都不是一个陌生的东西. ...

  3. 自定义View(1)简单流程及示例模板

    1,继承View , ViewGroup,或TextView等等 2,绘制相关的api, canvas 画布, paint 画笔 2,重写重要的函数(注意这个顺序) onMeasure 属于View的 ...

  4. BZOJ 2154 Crash的数字表格

    题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2154 题意: 思路: i64 mou[N]; void init(int N){    ...

  5. error: dst ref refs/heads/zhCN_v0.13.1 receives from more than one src.

    http://segmentfault.com/q/1010000000257571 想要把本地的分支推送到远端 git push chucklu zhCN_v0.13.1 zhCN_v0.13.1 ...

  6. WPF中的Drawing

    以前在用WinForm的时候,可以通过GDI+接口在窗体上动态绘制自定义的图形.在WPF中有没有对应的API呢,最近项目中用到了这个,在这里总结一下. WPF中的Drawing主要提供了几类API: ...

  7. org.tigris.subversion.javahl.ClientException: Attempted to lock an already-locked dir异常解决方法

    myeclipse用svn提交的时候报错: Attempted to lock an already-locked dir svn: Working copy 'D:/Program Files/My ...

  8. asp.net获取当前页面源码并生成静态页面

    StringWriter stringWriter = new StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(strin ...

  9. UVALive 4128 Steam Roller(最短路(拆点,多状态))

    题意:模拟了汽车的行驶过程,边上的权值为全速通过所消耗的时间,而起步(从起点出发的边).刹车(到终点结束的边).减速(即将拐弯的边).加速(刚完成拐弯的边)这四种不能达到全速的情况,消耗的时间为权值* ...

  10. I.MX6 show battery states in commandLine

    #/bin/sh # I.MX6 show battery states in commandLine # 声明: # 在命令行下自动显示电池状态的信息. # # -- # set battery r ...