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. js 选项卡

    <html><head lang="en"> <meta charset="UTF-8"> <title>Tab ...

  2. LintCode 11 二叉查找树的搜索区间

    题目链接:http://www.lintcode.com/zh-cn/problem/search-range-in-binary-search-tree/ 1.描述 给定两个值 k1 和 k2(k1 ...

  3. java中堆和堆栈的区别

    java中堆和堆栈的区别(一) 1.栈(stack)与堆(heap)都是Java用来在Ram中存放数据的地方.与C++不同,Java自动管理栈和堆,程序员不能直接地设置栈或堆. 2. 栈的优势是,存取 ...

  4. 转发:iOS开发系列--触摸事件、手势识别、摇晃事件、耳机线控

    -- iOS事件全面解析 转载来自崔江涛(KenshinCui) 链接:http://www.cnblogs.com/kenshincui/p/3950646.html 概览 iPhone的成功很大一 ...

  5. iOS开发——实时监控网速(仅作参考,发现一点问题)

    开发中用到获取网速的地方,应该就两种: 1.下载速度,这种可以直接在接受数据的地方统计计算.这个就不讲了. 2.获取手机网卡的数据,可以监控网卡的进出流量,下面就是. #import "Vi ...

  6. Extjs4中的布局

    布局用于定义容器如何组织内部子元素和控制子元素的大小.在一个应用程序中,作为定义容器的组织形式,布局是一个十分重要的组件.是显示单个子元素?还是垂直或水平显示多个子元素?这些均由布局来定义.并且布局将 ...

  7. 利用智能手机(Android)追踪一块磁铁(转)

    利用智能手机(Android)追踪一块磁铁(一) 利用智能手机(Android)追踪一块磁铁(二) 利用智能手机(Android)追踪一块磁铁(三)

  8. 10天学会phpWeChat——第八天:Form类,丰富表单提交的字段类型

    通过前面七讲的系列教程,我们完成了一个包含后台并自适应PC+h5移动端的文章管理模块. 在实际的生产环境中,文章投稿.商品上传等操作并不会简单局限于一个text和textarea组成的表单.在实际中, ...

  9. tp框架里的 删改

    //显示主页面 <table width="> <tr> <td>代号</td> <td>名称</td> <td ...

  10. IOS开发中使用CNContact\CNMutableContact 对通讯录增删改查

    IOS开发中使用CNContact\CNMutableContact 对通讯录增删改查 首先当然是把CNcontact包含在工程中: @import Contacts; 1.下面是增加联系人的程序段: ...