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.
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
代码如下:
 #include<cstdio>
#include<cstring>
#define N 10000001
char s[N];
int main()
{
long long mod;
int len;
int n=;
int kk=;
while(scanf("%s",s)!=EOF)
{
len=strlen(s);
mod=;
for(int i=; i<len; i++)
{
mod=mod*+s[i]-'';
mod=mod%n;
}
if(mod==){
printf("Case #%d: YES\n",kk);
}else{
printf("Case #%d: NO\n",kk);
}
kk++;
} return ;
}

题目大意:

一个星星一年73天,一个星星一年137天。给你一个天数,问两者是不是恰好都是第一天。

思路解析:

这题思路并不难想,就是求对73*173=10001取余是不是为0。这道题的坑就在大数的计算上。大数的取余计算,直接套模板。

(P.S:= =好累啊 下午5个小时 感觉身体被掏空。更一道下午的题算了,睡了睡了233333。)

CCPC网赛,HDU_5832 A water problem的更多相关文章

  1. ccpc网赛 hdu6703 array(权值线段树

    http://acm.hdu.edu.cn/showproblem.php?pid=6703 大意:给一个n个元素的数组,其中所有元素都是不重复的[1,n]. 两种操作: 将pos位置元素+1e7 查 ...

  2. ccpc网赛 hdu6705 path(队列模拟 贪心

    http://acm.hdu.edu.cn/showproblem.php?pid=6705 这是比赛前8题过的人数第二少的题,于是就来补了,但感觉并不难啊..(怕不是签到难度 题意:给个图,给几条路 ...

  3. hdu 5443 The Water Problem(长春网络赛——暴力)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Time Limit: 1500/1000 MS (Java ...

  4. Big Water Problem

    链接:https://www.nowcoder.com/acm/contest/77/B来源:牛客网 Big Water Problem 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ ...

  5. 2018 ACMICPC上海大都会赛重现赛 H - A Simple Problem with Integers (线段树,循环节)

    2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 H - A Simple Problem with Integers (线段树,循环节) 链接:https://ac.nowcoder.co ...

  6. HDU 5832 A water problem(某水题)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  7. hdu5832 A water problem

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

  8. hdu 5443 The Water Problem

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Description In Land waterless, ...

  9. [CCPC2016]网赛部分比赛代码

    来自HDOJ: 5833 ( Zhu and 772002 ) /* ━━━━━┒ギリギリ♂ eye! ┓┏┓┏┓┃キリキリ♂ mind! ┛┗┛┗┛┃\○/ ┓┏┓┏┓┃ / ┛┗┛┗┛┃ノ) ┓┏ ...

随机推荐

  1. 《Genesis-3D开源游戏引擎--横版格斗游戏制作教程06:技能播放的逻辑关系》

    6.技能播放的逻辑关系 技能播放概述: 当完成对技能输入与检测之后,程序就该对输入在缓存器中的按键操作与程序读取的技能表信息进行匹配,根据匹配结果播放相应的连招技能. 技能播放原理: 按键缓存器中内容 ...

  2. MYSQL存储过程中的IN、OUT和INOUT

    MYSQL存储过程中的IN.OUT和INOUT,不能简单理解为一个方法的参数和返回值,而是面向整个过程上下文变量的. 一.MySQL 存储过程参数(in) 基本可以理解为传入function的参数,而 ...

  3. 《Introduction to Algorithm》-chaper30-多项式与快速傅里叶变换

    两个n次多项式的相加最直接的方法所需要的时间是O(n),而实现两个n次多项式的乘法的直接方法则需要O(n^2),本章讨论的快速傅里叶变换(FFT),将会将这一过程的时间复杂度降至O(nlogn).同时 ...

  4. CentOS设置在同一窗口打开文件夹

    默认情况下,CentOS双击文件夹会打开一个新窗口.这对于习惯Windows的用户会感觉非常别扭.其实,如果用鼠标中键双击文件夹,就不会打开新窗口了.当然,也可以按照如下设置: 1.  打开任意一个文 ...

  5. Linux概念架构的理解

    摘要 Linux kernel成功的两个原因:(1)架构设计支持大量的志愿开发者加入到开发过程中:(2)每个子系统,尤其是那些需要改进的,都支持很好的扩展性.正式这两个原因使得Linux kernel ...

  6. dublin core实例

    <?xml version="1.0"?> <metadata xmlns="http://example.org/myapp/" xmlns ...

  7. [Angular 2] Handle Reactive Async opreations in Service

    When you use ngrx/store and you want to fire a service request. When it sucessfully return the respo ...

  8. Java中Map的使用

    Map以按键/数值对的形式存储数据,和数组很类似,在数组中存在的索引,它们本身也是对象.       Map的接口       Map---实现Map       Map.Entry--Map的内部类 ...

  9. c语言,strcmp(),字符串比较,看Asic 码,str1>str2,返回值 > 0;两串相等,返回

    #include<stdio.h> #include<string.h> int main() {  char *buffer1="aaa",*buffer ...

  10. DES加密系统的实现

    这是一个高内聚低耦合可复用的DES加密系统的实现. Github 链接:https://github.com/cyendra/CyDES 要实现加密系统,先考虑数据的基本单位. 在DES加密中,数据是 ...