2016中国大学生程序设计竞赛 - 网络选拔赛 1001 A water problem (大数取余)
Problem Descripton
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.
For each test, we have a line with an only integer N(0≤N), the length of N is up to 10000000.
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 (大数取余)的更多相关文章
- 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 ...
- 2018中国大学生程序设计竞赛 - 网络选拔赛 1001 - Buy and Resell 【优先队列维护最小堆+贪心】
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6438 Buy and Resell Time Limit: 2000/1000 MS (Java/O ...
- 2016中国大学生程序设计竞赛 - 网络选拔赛 J. Alice and Bob
Alice and Bob Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) ...
- 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 ...
- 2016中国大学生程序设计竞赛 - 网络选拔赛 1004 Danganronpa
Problem Description Chisa Yukizome works as a teacher in the school. She prepares many gifts, which ...
- 2016中国大学生程序设计竞赛 - 网络选拔赛 1011 Lweb and String
Problem Description Lweb has a string S. Oneday, he decided to transform this string to a new sequen ...
- 2018中国大学生程序设计竞赛 - 网络选拔赛 1010 YJJ's Salesman 【离散化+树状数组维护区间最大值】
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6447 YJJ's Salesman Time Limit: 4000/2000 MS (Java/O ...
- 2018中国大学生程序设计竞赛 - 网络选拔赛 1009 - Tree and Permutation 【dfs+树上两点距离和】
Tree and Permutation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Oth ...
- HDU 6154 - CaoHaha's staff | 2017 中国大学生程序设计竞赛 - 网络选拔赛
/* HDU 6154 - CaoHaha's staff [ 构造,贪心 ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 题意: 整点图,每条线只能连每个方格的边或者对角线 问面积大于n的 ...
随机推荐
- Prime Path(BFS)
Prime Path Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other) Total S ...
- 杭电20题 Human Gene Functions
Problem Description It is well known that a human gene can be considered as a sequence, consisting o ...
- shell笔记-local、export用法
local一般用于局部变量声明,多在在函数内部使用. 1. Shell脚本中定义的变量是global的,其作用域从被定义的地方开始,到shell结束或被显示删除的地方为止. 2. ...
- linux 内核协议栈收报流程(二)Netfilter全貌
ip层分片整理 int ip_local_deliver(struct sk_buff *skb){ /* * Reassemble IP fragments. */ if (ip_is_fragme ...
- zendstudio 安装 手册
安装 http://jingyan.baidu.com/article/b907e627b14fbb46e6891c65.html 选择baidu官方32bit安装 补丁破解网址 http://dwt ...
- JPA 系列教程18-自动把firstName+lastName合并为name字段
需求 设计的国际化网站,页面需要输入firstName,lastName,后台数据库只需要存储name属性. 页面获取的firstName,lastName持久化到数据库name属性,规则按照,分隔保 ...
- Extjs 树节点操作常用属性
tree: 树 node:节点 1.全部展开 tree.expandAll(); 2.全部收缩 tree.collapseAll(); 3.得到父节点 node.parentNode 4. ...
- RSA 公私钥 互换问题
关于 RSA,我的理解是: 按定义的话,公私钥是可以互换的 问题是常见的实现里面,保存“私钥”的那个数据结构或者文件,里面除了私钥所必需的那一对数之外,还有额外的信息(足以算出公钥来),所以绝对不能把 ...
- 理解 bashrc 和 profile(转)
转自:https://wido.me/sunteya/understand-bashrc-and-profile/ 在一般的 linux 或者 unix 系统中, 都可以通过编辑 bashrc 和 p ...
- SpringMVC 学习-如何搭配使用 Velocity 页面模板
一.快速搭建 Velocity 框架 1. 加入所需 Jar 包 <dependency> <groupId>org.apache.velocity</groupId&g ...