HDU 5832 A water problem
2016-08-15 00:13
197 查看
8.14日网络赛第1题
题目:点击打开链接
Description
Two planets named Haha and Xixi in the universe and they were created with the universe beginning.
There is
days
in Xixi a year and
days
in Haha a year.
Now you know the days
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
huge
test cases).
For each test, we have a line with an only integer
,
the length of
is
up to
.
Output
For the i-th test case, output Case #i: , then output "YES" or "NO" for the answer.
Sample Input
Sample Output
直接一位一位地算
我们队伍的代码:
虽然很慢,但是AC了
题目:点击打开链接
Description
Two planets named Haha and Xixi in the universe and they were created with the universe beginning.
There is
days
in Xixi a year and
days
in Haha a year.
Now you know the days
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
huge
test cases).
For each test, we have a line with an only integer
,
the length of
is
up to
.
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
直接一位一位地算
我们队伍的代码:
#include<cstdio> #include<cstdlib> #include<cstring> #define N 10000001 char str[N]; int len; int i; int mod; long long ans; int ca; int main() { mod = 10001; while(scanf("%s", str) != EOF) { ca++; ans = 0; len = strlen(str); for(i = 0; i < len; i++)ans = (ans * 10 + str[i]-'0') % mod; if(ans == 0) printf("Case #%d: YES\n", ca); else printf("Case #%d: NO\n", ca); } return 0; }
虽然很慢,但是AC了
相关文章推荐
- HDU 5832 A water problem
- 中国(北方)大学生程序设计训练赛(第一周)E. water problem
- Leetcode 365. Water and Jug Problem
- HDU 5832 A water problem (水题)
- hdu - 4974 - A simple water problem(贪心 + 反证)
- hdu5832 A water problem
- 【HDU 5832】A water problem(大数取模)
- 【线段树】HDU 5443 The Water Problem
- leetcode:数学:Water and Jug Problem(365)
- ACdream1734 Can you make a water problem?(贪心)
- hdu 5443 The Water Problem 2015 ACM/ICPC Asia Regional Changchun Online
- HDU 4974 A simple water problem(贪心)
- A simple water problem
- 2018年全国多校算法寒假训练营练习比赛(第五场)F-The Biggest Water Problem
- 牛客网NowCoder 2018年全国多校算法寒假训练营练习比赛(第五场)A.逆序数 B.Big Water Problem(线段树-区间查询求和和单点更新) F.The Biggest Water Problem H.Tree Recovery(线段树-区间查询求和和区间更新)
- GDUT2017校赛:Problem E: 倒水(Water)(思维,二进制)
- 2017广东工业大学程序设计竞赛决赛 Problem E: 倒水(Water)(思维)
- 365. Water and Jug Problem
- Contest2037 - CSU Monthly 2013 Oct (problem B :Scoop water)
- Codeforces Round #352 (Div. 2) B. Different is Good __ substrings water problem