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
10001 0 333Sample 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了