A water problem

Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 774    Accepted Submission(s): 397

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
 
大数取模
 //2016.8.16
#include<cstdio>
#include<cstring> using namespace std; char s[]; int main()
{
long long n, m, pos;
int kase = , len;
while(scanf("%s", s)!=EOF)
{
pos = n = m = ;
len = strlen(s);
while(pos < len)
{
for(int i = ; i < && pos<len; i++, pos++)
{
n = n*+(s[pos]-'');
m = m*+(s[pos]-'');
}
n %= ;
m %= ;
}
if(!n&&!m)printf("Case #%d: YES\n", ++kase);
else printf("Case #%d: NO\n", ++kase);
} return ;
}
 

HDU5832的更多相关文章

  1. hdu5832 A water problem

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

  2. A water problem (hdu-5832)

    不多说就是一个数对两个数的乘积求模运算 不得不说vj上这个题的翻译版本真是太暴力了 难点 主要还是时间的控制,这题太容易TLE了.用到的算法就是大数求余数的ans=(ans*10-a[i]-'0')% ...

  3. HDU 5832A water problem

    大数 判断整除 /* *********************************************** Author :guanjun Created Time :2016/8/14 1 ...

随机推荐

  1. 把中文版NetBeans改成英文版

    不管你从官网下的是英文版还是中文版,安装之后操作界面都是中文的.这是因为NetBeans会根据你的操作系统自动设置界面语言,并且没有提供更改的功能.解决的方法也很简单,下面介绍我用过的两种方法: 方法 ...

  2. eclipse java生成exe

    eclipse导出jar文件再将它转换成exe可执行文件详解 关键字: 欢迎光临 此文章是为了帮助刚接触j2se或不懂如何打包jar文件的人而着笔,同时也是让自己的知识以文章的形式保存起来. 一.导出 ...

  3. CodeForces 620E New Year Tree

    线段树+位运算 首先对树进行DFS,写出DFS序列,记录下每一个节点控制的区间范围.然后就是区间更新和区间查询了. 某段区间的颜色种类可以用位运算来表示,方便计算. 如果仅有第i种颜色,那么就用十进制 ...

  4. JS中获取和操作iframe

    一.需求与遇到的问题 在网站的后台管理中使用了iframe框架布局,包括顶部菜单.左侧导航和主页面.需求是:点击主页面上的一个按钮,在顶部菜单栏的右侧显示“退出”链接,点击可退出系统. 我的思路是:在 ...

  5. xml常用四种解析方式优缺点的分析×××××

    xml常用四种解析方式优缺点的分析 博客分类: xml   最近用得到xml的解析方式,于是就翻了翻自己的笔记同时从网上查找了资料,自己在前人的基础上总结了下,贴出来大家分享下. 首先介绍一下xml语 ...

  6. LPC1788的内部EEPROM使用

    Lpc1788内置有eeprom 使用代码 #ifndef __E2PRONINCHIP_H_ #define __E2PROMINCHIP_H #include "common.h&quo ...

  7. FFT初解(转)

    源:FFT初解 一.前言 首先申明俺不是一个算法工程师,俺是一个底层驱动工程师,有人会发问一个底层驱动工程师需要这个吗?但是我不幸的告诉你,确实是需要的,不过我们不要像算法工程师那样搞得很精通,但是还 ...

  8. jascript基础教程学习总结(2)

    摘自:javascript基础教程 用链接对用户进行重定向: js001.html 这个HTML页面基于链接对用户进行重定向 <!DOCTYPE html PUBLIC "-//W3C ...

  9. Mapreduce 反向索引

    反向索引主要用于全文搜索,就是形成一个word url这样的结构 file1: MapReduce is simple file2: MapReduce is powerful is simple f ...

  10. HUST 1601 Shepherd

    间隔小的时候dp预处理,大的时候暴力..正确做法不会... dp[i][j]表示以i为开头,间隔为j的和,递推:dp[i][j] = dp[i + j][j] + a[i] 测试数据中间隔可能是0.. ...