Problem Descripton

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

Sample Output
Case #: YES
Case #: YES
Case #: NO

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5832

***********************************************************

题意:嘻嘻和哈哈两个星球分别以73和137为一年的周期,给你天数,判断是否是两个星球的新一年第一天。

分析:周期嘛:10001就是73和137的最小公倍数。然后输入的是字符串,注意给的范围是字符串的长度不是数的大小,所以用到大数求余,仅此而已。

AC代码:

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <vector>
using namespace std; #define N 12000000
#define INF 0x3f3f3f3f char s[N]; int main()
{
int k=,len,x,d,i; while(scanf("%s", s) != EOF)
{
k++;
len = strlen(s); x=;
d=; for(i=;i<len;i++)
d=(d*+(s[i]-'')%x)%x; if(d==)
printf("Case #%d: YES\n",k);
else
printf("Case #%d: NO\n",k);
}
return ;
}

2016中国大学生程序设计竞赛 - 网络选拔赛 1001 A water problem (大数取余)的更多相关文章

  1. 2016中国大学生程序设计竞赛 - 网络选拔赛 C. Magic boy Bi Luo with his excited tree

    Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migi ...

  2. 2018中国大学生程序设计竞赛 - 网络选拔赛 1001 - Buy and Resell 【优先队列维护最小堆+贪心】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6438 Buy and Resell Time Limit: 2000/1000 MS (Java/O ...

  3. 2016中国大学生程序设计竞赛 - 网络选拔赛 J. Alice and Bob

    Alice and Bob Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  4. 2016中国大学生程序设计竞赛 网络选拔赛 I This world need more Zhu

    This world need more Zhu Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Jav ...

  5. 2016中国大学生程序设计竞赛 - 网络选拔赛 1004 Danganronpa

    Problem Description Chisa Yukizome works as a teacher in the school. She prepares many gifts, which ...

  6. 2016中国大学生程序设计竞赛 - 网络选拔赛 1011 Lweb and String

    Problem Description Lweb has a string S. Oneday, he decided to transform this string to a new sequen ...

  7. 2018中国大学生程序设计竞赛 - 网络选拔赛 1010 YJJ's Salesman 【离散化+树状数组维护区间最大值】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6447 YJJ's Salesman Time Limit: 4000/2000 MS (Java/O ...

  8. 2018中国大学生程序设计竞赛 - 网络选拔赛 1009 - Tree and Permutation 【dfs+树上两点距离和】

    Tree and Permutation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  9. HDU 6154 - CaoHaha's staff | 2017 中国大学生程序设计竞赛 - 网络选拔赛

    /* HDU 6154 - CaoHaha's staff [ 构造,贪心 ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 题意: 整点图,每条线只能连每个方格的边或者对角线 问面积大于n的 ...

随机推荐

  1. DLNA

    DLNA最早由索尼.英特尔.微软等提出,全称是DIGITAL LIVING NETWORK ALLIANCE,旨在解决个人PC,消费电器,移动设备在内的无线网络和有线网络的互联互通,其实就是解决电脑和 ...

  2. 比较全的 C# 操作 Word的代码

    using System;using System.Collections.Generic;using System.Text;using Microsoft.Office.Interop.Word; ...

  3. Meta标签中的属性及含义

    一.Meta标签中的format-detection属性及含义 format-detection翻译成中文的意思是“格式检测”,顾名思义,它是用来检测html里的一些格式的,那关于meta的forma ...

  4. RegisterWindowMessage介绍

    该函数为windows API之一 msdn地址:https://msdn.microsoft.com/en-us/library/windows/desktop/ms644947(v=vs.85). ...

  5. opencv使用convexityDefects计算轮廓凸缺陷

    引自:http://www.xuebuyuan.com/1684976.html http://blog.csdn.net/lichengyu/article/details/38392473 htt ...

  6. 2.Add Two Numbers-两个单链表相加

    You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...

  7. Ext 下拉框联动第一次显示不正常的问题

    做下拉框联动,异步加载数据,第一次显示时数据不准确,不要在combo_2的下拉框直接绑定store,在combo_1的改变事件里调用下面的方法 function GetAllCustomerBrand ...

  8. applicationContext.xml 配置(扫描)

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  9. 用开源软件建垂直搜索引擎 转载 http://news.cnblogs.com/n/60041/

    用Solr.Nutch等开源软件来构建电子元器件垂直搜索引擎涉及很多实现细节,本文结合实际应用系统对数据采集.中文搜索.结果输出.分页处理.整合数据库等重点问题提出了切实可行的解决方法. 用开源软件建 ...

  10. jspl零散知识点

    1.  读取配置文件. index.jsp: <body> <% String charset=config.getInitParameter("charset" ...