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. html5:地理信息 LBS基于地理的服务和百度地图API的使用

    地理位置请求 单次定位请求getCurrentPosition(请求成功函数,请求失败函数,数据收集方式) 多次定位请求watchPosition(请求成功函数,请求失败函数,数据收集方式) 关闭更新 ...

  2. TypeScript学习记录

    TypeScript官网 TypeScript中文网 TypeScrpit Handbook 中文版 DefinitelyTyped The TypeScript Definition Manager ...

  3. Thinking in Java——笔记(10)

    Inner Classes It allows you to group classes that logically belong together and to control the visib ...

  4. 集合中list、ArrayList、LinkedList、Vector的区别、Collection接口的共性方法以及数据结构的总结

    List (链表|线性表) 特点: 接口,可存放重复元素,元素存取是有序的,允许在指定位置插入元素,并通过索引来访问元素 1.创建一个用指定可视行数初始化的新滚动列表.默认情况下,不允许进行多项选择. ...

  5. C#编程之委托与事件四(二)【转】

    C#编程之委托与事件(二)       我在上一篇文章(C#编程之委托与事件(一) )中通过示例结合的方法介绍了委托,在本文中,我同样以代码示例的方式来介绍C#里的事件机制. 二.事件   1.了解概 ...

  6. Eclemma各种安装方式以及安装失败解决

    在线安装方法一: 在eclipse的菜单栏点击 Help -> Install New Software -> add Name:eclemma (名称可以随便填) Location:ht ...

  7. LeetCode Remove Duplicate Letters

    原题链接在这里:https://leetcode.com/problems/remove-duplicate-letters/ 题目: Given a string which contains on ...

  8. PL/SQL 存储函数和过程

    --存储过程 .不带参: create or replace procedure 存储过程名 as|is --说明部分 begin --执行的语句: end: 调用存储过程 execute 存储过程名 ...

  9. @Autowired获取被@Service注解的bean为null的问题

    先说结论:Spring容器还没有加载完Bean,你就去调用了! 一般的注解没加,bean的名字写错都好检查,但是逻辑错误就需要看清自己的思维过程了. 实例:在使用ActiveMq的过程中,第一步对Ac ...

  10. C# 刷新页面浏览次数(点击量)+1

    页面视图: <p class="text-center text-muted">文章来源:@ent.Origin 点击量:@ent.Hits <Script La ...