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. grep过滤搜索

    cat /proc/2666/maps | busybox grep libumcpart.so

  2. margin 塌陷现象 与 注意事项

    1.在标准文档流中,块级标签之间竖直方向的margin会以大的为准,这就是margin的塌陷现象. 但是,脱标之后就不会出现margin的塌陷现象. 2.margin:0 auto;  会让盒子水平居 ...

  3. Firefox 插件 JSview是一套比较实用的JS,CSS文件查看工具,很方便,很快捷地查看页面引用了哪些文件,作为Web前端开发者是一套必备的插件,由于Firefox升级过快,插件很快不兼容了,这里对插件做了一些调整,可以兼容最新Firefox浏览器(目前FireFox 21)

    JSView Firefox Plugins Download  点击下载

  4. $(srctree) is not clean, please run 'make mrproper'

    在使用make menuconfig重新配置后,再编译kernel时常会遇到这样的问题: Using /home/likewise-open/BJS/lisa.liu/code/sprdroid4.0 ...

  5. IBATIS事务处理 - - 博客频道 - CSDN.NET

    body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...

  6. javadoc时候乱码-编码 GBK 的不可映射字符 - wqjsir的专栏 - 博客频道 - CSDN.NET

    body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...

  7. FastCgi与Cgi

      转载请注明出处:http://www.cnblogs.com/stonehat/p/6286966.html  他们之间的不同在于   FastCgi的进程是常驻的,监听一个socket, 无线循 ...

  8. 不小心删掉root目录......

    1.先保存还剩下的的东西,比如说桌面的文件,保存在/下面其他目录 2.执行命令 cp -R /etc/skel/.[!.]* ./ 3.reboot

  9. Linux Apache2 配置介绍

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

  10. 《数据结构与算法分析:C语言描述》读书笔记------List的C语言实现

    List的简单实现.在GCC下测试通过. list.h #ifndef _List_H /*List数据结构的简单实现*/ struct Node; typedef struct Node Node; ...