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.

 
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.

宇宙之中有Haha与Xixi两星,鸿蒙时代既存。

Xixi一年73天,Haha一年137天

现在你被告知宇宙大爆炸后已过N天,待你断定这是否是两颗星球一年中的第一天。

CN

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.

多组测试用例(大约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(某水题)的更多相关文章

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

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

  2. HDU 5443 The Water Problem (水题,暴力)

    题意:给定 n 个数,然后有 q 个询问,问你每个区间的最大值. 析:数据很小,直接暴力即可,不会超时,也可以用RMQ算法. 代码如下: #include <cstdio> #includ ...

  3. HDU 5832 A water problem (带坑水题)

    A water problem 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...

  4. HDU 5832 A water problem 水题

    A water problem 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...

  5. HDU 5832 A water problem

    A water problem Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

  6. fzuoj Problem 2182 水题

    http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188    Submit: 277Time Limit: 100 ...

  7. HDU 2096 小明A+B --- 水题

    HDU 2096 /* HDU 2096 小明A+B --- 水题 */ #include <cstdio> int main() { #ifdef _LOCAL freopen(&quo ...

  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 2117:Just a Numble(水题,模拟除法运算)

    Just a Numble Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

随机推荐

  1. 【iCore3 双核心板_FPGA】例程六:计数器实验——计数器使用

    实验指导书及代码包下载: http://pan.baidu.com/s/1kUiAAt5 iCore3 购买链接: https://item.taobao.com/item.htm?id=524229 ...

  2. myBatis批量查询操作,xml中使用foreach案例

    使用场景:有一个订单表,实体类为OrderBase.java,订单有个状态为status值可能为"1,2,3,4,5,6",现在需要查询状态为"2,3,4"的订 ...

  3. lsof 一切皆文件

    Docs » 工具参考篇 » 3. lsof 一切皆文件 Docs » 工具参考篇 » 3. lsof 一切皆文件 Edit on GitHub 3. lsof 一切皆文件¶ lsof(list op ...

  4. 腾迅股票数据接口 http/javascript

    腾迅股票数据接口 http/javascript 分类: Finance Perl2012-12-21 23:48 31132人阅读 评论(3) 收藏 举报 之前使用了新浪的股票数据,由于新浪http ...

  5. MySQL 的 utf8_general_ci 和 utf8_unicode_ci 有什么区别,应如何选择?

    一般的解说是 utf8_general_ci 速度较快,utf8_unicode_ci 准确性较好 … 但快在那里,又好在什么地方呢? 首先就其准确性说,这世界上有无数种文字,除了通用的英文使用我们较 ...

  6. mongodb的使用

    1.启动mongodb 启动mongodb在Linux中可以进入mongodb的bin目录下执行      ./mongod -dbpath=所建立的数据文件夹  -logpath=所建立的日志文件 ...

  7. Win8.1密钥

    Win8.1 在线永久激活密钥一枚!  78BHN-M3KRH-PCP9W-HQJYR-Q9KHD [剩余次数:7K多+] 继续增加 [Key]:HPCJW-VGYW4-CR7W2-JG6Q7-K4Q ...

  8. Android 自定义spinner下拉框实现的实现

    请支持原创:http://blog.csdn.NET/geniuseoe2012/article/details/8723702 说到Android下拉框spineer,框架中虽有现成的控件,但实际效 ...

  9. Android 第三方开源下拉框:NiceSpinner

    Android原生的下拉框Spinner基本上可以满足Android开发对于下拉选项的设计需求,但现在越来越流行的下拉框不满足于Android原生提供的下拉框Spinner所提供的设计样式,而改用自定 ...

  10. CocoaPod遇到更新不了的原因

    CocoaPods 1.0.1 is available. To update use: `gem install cocoapods` Until we reach version 1.0 the ...