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. HW3.18

    import javax.swing.JOptionPane; public class Solution { public static void main(String[] args) { Str ...

  2. 在 windows 上面安装 tensorflow

    这个是 tensorflow 官网地址, https://www.tensorflow.org/get_started/os_setup#pip_installation_on_windows 上面有 ...

  3. Win+R指令(1)

    CMD命令:开始->运行->键入cmd或command(在命令行里可以看到系统版本.文件系统版本)1. appwiz.cpl:程序和功能 2. calc:启动计算器 3. certmgr. ...

  4. 用Ajax调用web api,解决URL太长的问题;

    本来是用的WCF,但是服务需要多种方式调用(后台+前端Ajax),最终局面就是我在WCF每个服务中都判断一下↓ #region 解决接收不到Ajax中传来的参数... if (jsonParames ...

  5. ONIX 实例

    <?xml version="1.0"?><!DOCTYPE ONIXMessage SYSTEM"http://www.editeur.org/oni ...

  6. FireMonkey 使用Webbrowser

    DELPHI XE5 源码PASCAL:http://files.cnblogs.com/xe2011/FireMonkey_Webbrowser.rar 为了这个用上webbrowser真是费太大劲 ...

  7. android开发Proguard混淆与反射

    http://charles-tanchao.diandian.com/post/2012-05-24/20118715 由于前面开发数据操作类,所以利用反射,封装了一个BaseDao,本来在平常的时 ...

  8. [React] Using the classnames library for conditional CSS

    Classnames is a simple yet versatile javascript utility that joins CSS class names based on a set of ...

  9. C# - 集合类 - 集合类型

    Stack类 ns:System.Collections 此类模仿了一个简单的先进后出(LIFO)的集合 它实现了ICollection接口 可以通过三种方式创建Stack类对象 Stack stac ...

  10. 认识CoreData-基础使用

    第一篇文章中并没有讲CoreData的具体用法,只是对CoreData做了一个详细的介绍,算是一个开始和总结吧. 这篇文章中会主要讲CoreData的基础使用,以及在使用中需要注意的一些细节.因为文章 ...