HDU 5832 A water problem (带坑水题)
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 (带坑水题)的更多相关文章
- HDU 5832 A water problem(某水题)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- HDU 5832 A water problem 水题
A water problem 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...
- HDU 5832 A water problem
A water problem Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)T ...
- HDU 5832 A water problem (水题,大数)
题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...
- CODE FESTIVAL 2017 qual B B - Problem Set【水题,stl map】
CODE FESTIVAL 2017 qual B B - Problem Set 确实水题,但当时没想到map,用sort后逐个比较解决的,感觉麻烦些,虽然效率高很多.map确实好写点. 用map: ...
- hdu 5443 The Water Problem 线段树
The Water Problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- hdu 5443 The Water Problem
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Description In Land waterless, ...
- hdu 5443 The Water Problem(长春网络赛——暴力)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Time Limit: 1500/1000 MS (Java ...
- hdu 2393:Higher Math(计算几何,水题)
Higher Math Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
随机推荐
- Ubuntu 64位系统安装StarUML之最佳实践
preview 相信很多使用Ubuntu的哥们在安装StarUML或者其他软件时都会遇到要求libgcrypt11的依赖.而遗憾的时,这个东西很多人根本找不到. 我将它分享到百度网盘,mark. 一. ...
- word编辑器解码集合
$(document).ready(function () { $(".content").each(function () { var content = $(this).htm ...
- [POJ 3498] March of the Penguins
March of the Penguins Time Limit: 8000MS Memory Limit: 65536K Total Submissions: 4378 Accepted: ...
- php yii框架使用MongoDb
1.安装 运行 php composer.phar require --prefer-dist yiisoft/yii2-mongodb or add "yiisoft/yii2-mongo ...
- FFMPEG 库移植到 VC 需要的步骤
在VC下使用FFMPEG编译好的库,不仅仅是把.h,.lib,.dll拷贝到工程中就行了,还需要做以下几步.(此方法适用于自己使用MinGW编译的库,也同样适用于从网上下载的编译好的库,例如http: ...
- LINUX启动ORACLE监听和服务
可通过secureCRT或者telnet直接连 启动监听命令:lsnrctl start 成功启动后:sqlplus /nolog 回车 conn / as sysdba 回车 startup 回车 ...
- win7/8下VirtualBox虚拟共享文件夹设置
1. 安装增强功能包(VBoxGuestAdditions) 打开虚拟机,运行ubuntu,在菜单栏选择"设备->安装增强功能",根据提示即可安装成功(成功后也可 以实现 ...
- MVC中前台所得
前台页面时间格式修改: @item.CreateTime.ToString("yyyy-MM-dd hh:mm:ss") 前台方法调用传参数: <a href="# ...
- 搞明白这八个问题,Linux系统就好学多了。
正在犹豫入坑Linux学习的同学或者已经入坑的同学,经常会问到这样八个问题.今天,这些问题我都会一一解答,希望我的看法能帮助各位同学.常言道“好的开始是成功的一半”,如果你明白了以下八个问题,就能有一 ...
- ZOJ 3329-One Person Game(概率dp,迭代处理环)
题意: 三个色子有k1,2,k3个面每面标号(1-k1,1-k2,1-k3),一次抛三个色子,得正面向上的三个编号,若这三个标号和给定的三个编号a1,b1,c1对应则总和置零,否则总和加上三个色子标号 ...