HDU 5832 A water problem(某水题)
HDU 5832 A water problem(某水题)
Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Problem Description - 题目描述
Two planets named Haha and Xixi in the universe and they were created with the universe beginning.
宇宙之中有Haha与Xixi两星,鸿蒙时代既存。 Xixi一年73天,Haha一年137天 现在你被告知宇宙大爆炸后已过N天,待你断定这是否是两颗星球一年中的第一天。
CN
Input - 输入
There are several test cases(about 5 huge test cases).
多组测试用例(大约5组特大数据)。 对于每组测试用例,给出一行仅有一个整数N(≤N),N的长度高达10000000。
CN
Output - 输出
For the i-th test case, output Case #i: , then output "YES" or "NO" for the answer.
对于第i个测试用例,先输出Case #i: ,再输出回答"YES"或"NO"。
CN
Sample Input - 输入样例
10001
0
333
Sample Output - 输出样例
Case #1: YES
Case #2: YES
Case #3: NO
题解
大数取模
类似输入挂的读取方式,不过直接按照输入挂的做法读取一个字符处理一次IO开销太大,会超时,先保存进数组再处理可以极大地提高速度。
代码 C++
#include <cstdio>
#define mod 10001
char data[];
int main(){
int n, i = , j;
while (gets(data)){
printf("Case #%d: ", ++i);
for (j = n = ; data[j]; ++j) n = (n * + data[j] - '') % mod;
if (n == ) puts("YES");
else puts("NO");
}
return ;
}
HDU 5832 A water problem(某水题)的更多相关文章
- HDU 5832 A water problem (水题,大数)
题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...
- HDU 5443 The Water Problem (水题,暴力)
题意:给定 n 个数,然后有 q 个询问,问你每个区间的最大值. 析:数据很小,直接暴力即可,不会超时,也可以用RMQ算法. 代码如下: #include <cstdio> #includ ...
- 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 题目连接: 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 ...
- fzuoj Problem 2182 水题
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188 Submit: 277Time Limit: 100 ...
- HDU 2096 小明A+B --- 水题
HDU 2096 /* HDU 2096 小明A+B --- 水题 */ #include <cstdio> int main() { #ifdef _LOCAL freopen(&quo ...
- hdu 5443 The Water Problem(长春网络赛——暴力)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Time Limit: 1500/1000 MS (Java ...
- hdu 2117:Just a Numble(水题,模拟除法运算)
Just a Numble Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
随机推荐
- 总结-swing、JFrame、JScrollPane、JTabbedPane、JEditorPane
总结-swing.JFrame.JButton.JScrollPane.JLabel.JTabbedPane.JEditorPane 1.JButton内边距(去掉按钮里的空白):setMargin2 ...
- java发布web项目
Java Web 项目发布流程 一.基本条件 jdk tomcat 二.操作步骤 4.生成war包:Eclipse:右键项目->Export->WAR file,如:hello.war 4 ...
- Tomcat调优
问题定位 对于Tomcat的处理耗时较长的问题主要有当时的并发量.session数.内存及内存的回收等几个方面造成的.出现问题之后就要进行分析了. 1.关于Tomcat的session数目 这个可以直 ...
- 关于int,long,long long
偶然的,我同学给我发了一个面试题:long 占多少字节 对于这个问题我也不好多说,有时候可能会想的比较多,这个题也需要多想一下 <1>在16位机器上,int 2字节, long 4字节, ...
- 《linux内核设计与实现》读书笔记第十八章
第18章 调试 18.1 准备开始 准备工作需要的是: 一个bug 一个藏匿bug的内核版本 相关内核代码的知识和运气 18.2 内核中的bug 内核中bug的产生原因 从明白无误的错误代码——没有把 ...
- javascript 隐性类型转换步骤
这里说的隐性类型转换,是==引起的转换. 如果存在NaN,一律返回false 再看有没有布尔,有布尔就将布尔转换为数字 接着看有没有字符串, 有三种情况,对方是对象,对象使用toString进行转换: ...
- mysql重点--正确使用
1.一些错误情况 数据库表中添加索引后确实会让查询速度起飞,但前提必须是正确的使用索引来查询,如果以错误的方式使用,则即使建立索引也会不奏效.即使建立索引,索引也不会生效: - like '%xx' ...
- py操作mysql
1.操作mysql的标准流程 import pymysql conn = pymysql.connect(host = "127.0.0.1", port = 3306,user ...
- MVC_表单和HTML辅助方法
表单的使用 action特性告知Web浏览器信息发往哪里. method特性告知浏览器使用HTTP POST 还是 HTTP GET. GET请求用于读操作, POST请求用于写操作 HTML辅助方法 ...
- luaprofiler探索
什么是luaprofiler? http://luaprofiler.luaforge.net/manual.html LuaProfiler is a time profiler designed ...