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. Python中的split()函数的使用方法

    函数:split() Python中有split()和os.path.split()两个函数,具体作用如下:split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表(lis ...

  2. 配置centos 7 mysql

    http://www.cnblogs.com/starof/p/4680083.html 一.系统环境 yum update升级以后的系统版本为 [root@yl-web yl]# cat /etc/ ...

  3. POJ 3252 Round Numbers(组合)

    题目链接:http://poj.org/problem?id=3252 题意: 一个数的二进制表示中0的个数大于等于1的个数则称作Round Numbers.求区间[L,R]内的 Round Numb ...

  4. Android开发之事件分发和Listener

    参考:http://blog.csdn.net/zhongkejingwang/article/details/38141719 http://blog.csdn.net/zhongkejingwan ...

  5. 转:java提取图片中的像素

    本文转自:http://www.infosys.tuwien.ac.at/teaching/courses/WebEngineering/References/java/docs/api/java/a ...

  6. 使用easyui实现列表的批量删除

    使用easyui实现列表的批量删除 首先要做的就是增加一个多选框 <table id="otGrid" nowrap="false" style=&quo ...

  7. hdu 4939 Stupid Tower Defense ( dp )

    题目链接 题意:给出一条长为n个单位长度的直线,每通过一个单位长度需要t秒. 有3种塔,红塔可以在当前格子每秒造成x点伤害,绿塔可以在之后的格子每秒造成y点伤害, 蓝塔可以使通过单位长度的时间增加z秒 ...

  8. HDU 4869 Turn the pokers (2014 Multi-University Training Contest 1)

    Turn the pokers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  9. btr_pcur_t

    /** Persistent cursor */ typedef struct btr_pcur_struct btr_pcur_t; /* The persistent B-tree cursor ...

  10. 宏os_file_read_func

    # define os_file_read(file, buf, offset, offset_high, n) \ os_file_read_func(file, buf, offset, offs ...