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. 多维数组问题 int (*a)[] int []

    今天做调整方阵这道题: 第一遍提交没有通过, 又gdb 重新温故了 交换二维数组中的两行数据: void swap(int *a, int *b) { int t = *a; *a = *b; *b ...

  2. C# 拷贝数组的几种方法

    已知数组如下: int[] array = { 1, 5, 9, 3, 7, 2, 8 ,6, 4}; (1).引用复制,易引起错误,不推荐 int[] copy = array; (2).遍历拷贝 ...

  3. INSTRUCTION CYCLE

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION • Fetch: Read the nex ...

  4. NULL-safe equal

    http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#operator_equal-to ,=NULL,NULL=NULL; ...

  5. IIS7配置PHP 报错 "对找不到的文件启用文件监视"

    原文 IIS7配置PHP5.4报错对找不到的文件启用文件监视怎么解决? 案例环境:windows2008+IIS7+PHP5.4+ZEND LOADER用户在配置后遇到报错:错误摘要 HTTP 错误 ...

  6. ios 父VIew的宽度 等于较大view的宽度,并且垂直居中

       白色view上面有两个子View,红色view和橙色view.白色view的宽度等于橙色view和红色view宽度较大的一个,并且橙色view和红色view垂直居中, Masonry布局如下: ...

  7. 为什么微信android图片质量会比iphone的差?

    为什么微信android图片质量会比iphone的差? 我们团队最初也纠结过这个问题,费了半天劲.绕了好大圈,直到最后才发现,原来这是谷歌犯得一个“小”错误,而且一直错到了今天. 谷歌的错就在于:li ...

  8. JS之获取样式

    基本代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  9. ios编程之网络请求

    网络请求有GET请求和POST请求,get和post实现的时候可以选择同步或者异步实现.看一个请求是GET还是POST就看网址后面有没有携带请求体. GET与POST 区别  1.get请求 请求的网 ...

  10. ++i 与 i++ 区别

    i++返回原来的值 ++i 返回i+1的值   但是i++  i的值也会增加1 但是返回还是原来的值 int i = 1; i = i++; System.out.println(i); 输出 1 i ...