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. Git 常用命令汇总

    #安装git yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel yum install -y g ...

  2. javascript 中 arguments.callee属性

    javascript 中 arguments.callee属性 可以在函数内部,指向的是这个函数(或者叫做“类”)本身. 相当于PHP 中的 self 关键字. The arguments.calle ...

  3. PHP和MySQL Web开发(原书第4版) 高清PDF+源代码

    PHP和MySQL Web开发(原书第4版) 高清PDF+源代码 [日期:2014-08-06] 来源:Linux社区  作者:Linux [字体:大 中 小]     内容简介 <PHP和My ...

  4. Linux Apache2 配置介绍

    转自:http://blog.csdn.net/hursing/article/details/18730813 apache原指http server程序,后来成为了该程序的组织名,所以把原程序名定 ...

  5. MySQL的mysql_insert_id和LAST_INSERT_ID

    摘要:mysql_insert_id和LAST_INSERT_ID二者作用一样,均是返回最后插入值的ID 值 1 mysql_insert_id 一.PHP获取MYSQL新插入数据的ID  mysql ...

  6. js Date 日期格式化(转)

    var myDate = new Date();myDate.getYear();        //获取当前年份(2位)myDate.getFullYear();    //获取完整的年份(4位,1 ...

  7. double和real型有什么区别 [

    DOUBLE是双精度浮点数REAL  是实数类型,他包括 DOUBLE,SINGLE等类型

  8. Java通过JNI调用dll详细过程(转)

    源:Java通过JNI调用dll详细过程 最近项目有这样一个需求,在已有的CS软件中添加一个链接,将当前登录用户的用户名加密后放在url地址中,在BS的login方法里通过解密判断,如果为合法用户则无 ...

  9. jquery-ui-widget

    编写jQueryUI插件(widget) 使用jQueryUI的widget来写插件,相比于基本的jquery插件有一些好处: * 方便实现继承,代码重用 * 默认是单例 * widget已经给你实现 ...

  10. uboot移植前奏

    Tiny4412开发板硬件版本为:       底板:  Tiny4412/Super4412SDK 1506        核心板:Tiny4412 - 1412 1.下载u-boot源代码,建立u ...