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. CodeForces 614A Link/Cut Tree

    #include<cstdio> #include<cstring> #include<cmath> #include<stack> #include& ...

  2. git fetch

    http://www.ruanyifeng.com/blog/2012/07/git.html 流程 默认情况下,git fetch取回所有分支(branch)的更新.如果只想取回特定分支的更新,可以 ...

  3. 我的云服务之WWW

    云服务器系统是:[root@ip-172-31-27-132 system]# cat /etc/redhat-release Red Hat Enterprise Linux Server rele ...

  4. __bridge,__bridge_transfer和__bridge_retained的使用和区别【转载】

    __bridge,__bridge_transfer和__bridge_retained的使用和区别[转载] Core Foundation 框架Core Foundation框架 (CoreFoun ...

  5. ice grid 完整部署过程

    待补充 一 理论准备 一个IceGrid集群有一个registry(注册表,用于定位)和多个node组成. IceGrid配置包括集群配置和应用配置: config.grid是集群配置,配置Regis ...

  6. 在阿里云ECS(CentOS6.5)上安装redis

    下载所需的redis 命令: wget http://download.redis.io/releases/redis-3.0.7.tar.gz 结果: 解压redis压缩文件: 命令: .tar.g ...

  7. 《算法导论》Problem 2-4 Inversions

    在Merge Sort的基础上改改就好了. public class Inversions { public static int inversions(int [] A,int p, int r) ...

  8. lPC1788驱动SDRAM

    Sdram型号为hy57v256 #ifndef __SRAM_H_ #define __SRAM_H_ #include "common.h" #include "de ...

  9. 关于iOS开发中info.plist文件的解读

    我们建立一个工程后,会在Supporting files下面看到一个"工程名-Info.plist"的文件,这个是对工程做一些运行期配置的文件,很重要,不能删除.  下面就对其ke ...

  10. iOS开发之圆角指定 分类: ios技术 2015-05-25 16:26 191人阅读 评论(0) 收藏

    如果需要将UIView的4个角全部都为圆角,做法相当简单,只需设置其Layer的cornerRadius属性即可(项目需要使用QuartzCore框架).而若要指定某几个角(小于4)为圆角而别的不变时 ...