Problem Descripton

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

Sample Output
Case #: YES
Case #: YES
Case #: NO

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5832

***********************************************************

题意:嘻嘻和哈哈两个星球分别以73和137为一年的周期,给你天数,判断是否是两个星球的新一年第一天。

分析:周期嘛:10001就是73和137的最小公倍数。然后输入的是字符串,注意给的范围是字符串的长度不是数的大小,所以用到大数求余,仅此而已。

AC代码:

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <vector>
using namespace std; #define N 12000000
#define INF 0x3f3f3f3f char s[N]; int main()
{
int k=,len,x,d,i; while(scanf("%s", s) != EOF)
{
k++;
len = strlen(s); x=;
d=; for(i=;i<len;i++)
d=(d*+(s[i]-'')%x)%x; if(d==)
printf("Case #%d: YES\n",k);
else
printf("Case #%d: NO\n",k);
}
return ;
}

2016中国大学生程序设计竞赛 - 网络选拔赛 1001 A water problem (大数取余)的更多相关文章

  1. 2016中国大学生程序设计竞赛 - 网络选拔赛 C. Magic boy Bi Luo with his excited tree

    Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migi ...

  2. 2018中国大学生程序设计竞赛 - 网络选拔赛 1001 - Buy and Resell 【优先队列维护最小堆+贪心】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6438 Buy and Resell Time Limit: 2000/1000 MS (Java/O ...

  3. 2016中国大学生程序设计竞赛 - 网络选拔赛 J. Alice and Bob

    Alice and Bob Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  4. 2016中国大学生程序设计竞赛 网络选拔赛 I This world need more Zhu

    This world need more Zhu Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Jav ...

  5. 2016中国大学生程序设计竞赛 - 网络选拔赛 1004 Danganronpa

    Problem Description Chisa Yukizome works as a teacher in the school. She prepares many gifts, which ...

  6. 2016中国大学生程序设计竞赛 - 网络选拔赛 1011 Lweb and String

    Problem Description Lweb has a string S. Oneday, he decided to transform this string to a new sequen ...

  7. 2018中国大学生程序设计竞赛 - 网络选拔赛 1010 YJJ's Salesman 【离散化+树状数组维护区间最大值】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6447 YJJ's Salesman Time Limit: 4000/2000 MS (Java/O ...

  8. 2018中国大学生程序设计竞赛 - 网络选拔赛 1009 - Tree and Permutation 【dfs+树上两点距离和】

    Tree and Permutation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  9. HDU 6154 - CaoHaha's staff | 2017 中国大学生程序设计竞赛 - 网络选拔赛

    /* HDU 6154 - CaoHaha's staff [ 构造,贪心 ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 题意: 整点图,每条线只能连每个方格的边或者对角线 问面积大于n的 ...

随机推荐

  1. 8.17HTML 标签

    1.HTML body属性: bgbgcolor      页面背景色 text              文字颜色 topmargin     上页面边距 leftmargin      左 rig ...

  2. url 取出文件扩展名

    /**url 取出文件扩展名 *///方法一function getExt1($url) {    $arr = parse_url($url);    $file = basename($arr[' ...

  3. cocos2d-x 获得系统语言繁体

    IosLocalUtil.h #ifndef __IOS_LOCALUTIL_H__ #define __IOS_LOCALUTIL_H__ class IosLocalUtil{ public: s ...

  4. Java中try-catch-finally的一点理解

    在只有try-catch语句中,如果catch块中出现了return语句或者抛出了异常,那么catch之后的语句是执行不到的:但是如果将代码放入finally中,即使catch中出现了return语句 ...

  5. IoC容器Autofac正篇之解析获取(六)

    解析获取的方式有如下几种: Resolve class Program { static void Main(string[] args) { var builder = new ContainerB ...

  6. 构造DataTable

    手动构造一个DataTable: DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(string)); dt. ...

  7. ACboy needs your help again!

    ACboy needs your help again! Time Limit : 1000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Ja ...

  8. CentOS6.6 部署Apache+Svn

    svn代码 目前大多数公司 管理代码都是用这个 这个比较方便简单,git用的人数也比较多,我们下面来部署一下这个程序 svn+apache集成 系统环境 # cat /etc/redhat-relea ...

  9. jquery给html元素添加内容

    append() - 在被选元素的结尾插入内容 prepend() - 在被选元素的开头插入内容 after() - 在被选元素之后插入内容 before() - 在被选元素之前插入内容 实例 $(& ...

  10. Java 类的加载过程(阿里面试题)

    问以下程序打印出什么内容: 问题及解析如下: /** * 加载方法不等于执行方法,初始化变量则会赋值 * 类加载顺序应为 加载静态方法-初始化静态变量-执行静态代码块 * 实例化时 先加载非静态方法- ...