HDU 5832 A water problem 水题
A water problem
题目连接:
http://acm.hdu.edu.cn/showproblem.php?pid=5832
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
Hint
题意
给你一个数,问你这个数是否能够整除137和73
题解:
这两个数互质,其实就是问你能否整除10001
这个直接扫一遍就好了。
用string可能会TLE,所以老老实实用char就好了
代码
#include<bits/stdc++.h>
using namespace std;
char s[10000005];
int cas = 0;
int main(){
while(scanf("%s",s)!=EOF){
int mod1 = 0;int len=strlen(s);
for(int i=0;i<len;i++){
mod1=(mod1*10+s[i]-'0')%10001;
}
if(mod1==0)printf("Case #%d: YES\n",++cas);
else printf("Case #%d: NO\n",++cas);
}
}
HDU 5832 A water problem 水题的更多相关文章
- HDU 5832 A water problem(某水题)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- HDU 5832 A water problem (带坑水题)
A water problem 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...
- hdu-5867 Water problem(水题)
题目链接: Water problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Othe ...
- HDU 5832 A water problem
A water problem Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)T ...
- HDU 5832 A water problem (水题,大数)
题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- hdu 5443 The Water Problem(长春网络赛——暴力)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5443 The Water Problem Time Limit: 1500/1000 MS (Java ...
- hdu 1005:Number Sequence(水题)
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- hdu 1018:Big Number(水题)
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
随机推荐
- Spring RedisTemplate操作-HyperLogLog操作(7)
@Autowired @Resource(name="redisTemplate") private RedisTemplate<String, String> rt; ...
- Logistic Regression – Geometric Intuition
Logistic Regression – Geometric Intuition Everybody who has taken a machine learning course probably ...
- [转载]Cross-Platform Development in Visual Studio
http://msdn.microsoft.com/en-us/library/dn771552.aspx http://www.cnblogs.com/mengkzhaoyun/p/4152823. ...
- 详谈ASP.NET的DataReader对象
最近频繁用到了DataReader这个对象,其实对于DataReader,之前也用到过,说实话我个人觉得很不好懂.相比之下觉得DataSet对象好用的多,但是有时取出的数据不需要很多的时候,DataR ...
- Myeclipse/STS 首次在本地部署配置一个Spring MVC 项目 (十二)
1. 在本地新创建一个文件夹 ,做为项目工作空间; 2. 用 Myeclipse 或 STS 进入该文件夹,该文件夹就成为项目的工作空间: 3. 就要进 窗口-首选项,配置: 环境默认编码: 1> ...
- 【两分钟教程】如何更改Xcode项目名称
注意:视频在最后,还少了一个步骤:将Xcode中的名字叫做<企信通>的虚拟文件夹删掉,然后重新从硬盘中添加进来,这样就彻底完成了更改Xcode项目名称的目的.
- MAC Book 共享网络连接
CHENYILONG Blog MAC Book 共享网络连接 MAC Book 共享网络连接 MAC比Windows共享连接要方便很多,只需要以下两步操作: 1.打开系统偏好设置,选择共享 2.选择 ...
- Quartus II 安装教程—FPGA入门教程【钛白Logic】
Quartus II 工具安装一般分为两个部分,首先是开发工具本身的安装,其次就是器件库的安装,我们可以根据我们的需要选择相应的器件库来安装,这里我们使用Cyclone IV的FPGA,即安装Cycl ...
- 让linux中 history显示每条命令的操作时间及操作用户【转】
一.history 中显示日期时间用户名的办法 history 命令,用来显示命令行上的操作记录 不过默认是仅显示操作命令行本身,而没有记录操作时间等细节 例如 这样,我们查找记录时很麻烦,想回顾下某 ...
- 乐视max2 在开发中无法打印某些logcat 解决方案
乐视屏蔽了打印log.d等类型logcat.解决方案:拨号键盘 *#*#76937#*#* 出现页面后选最下面那个选项就有了.