A Water Problem
Time limit:5000/2500 MS (java/others) Memory limit:65536/65536 K (java/others)
Total submission (s): 650 Accepted Submission (s): 333
Problem Descriptiontwo planets named Haha and Xixi in the universe and they were created with the universe beginning.
There is Xixi a year and 137 days in Haha a year.
Now your know the day N after Big Bang, you need to answer whether it's the first day in a The planets. Inputthere is several test cases (about5Huge test cases).
For each test, we have a and a only integer< Span id= "mathjax-span-14" class= "Mrow" >n (0 ≤n) , the length of n is up To 10000000 . Outputfor The i-th test case, output case #i: And then output "YES" or "NO" for the answer. Sample Input100010333 Sample Outputcase #1: yescase #2: yescase #3: NO
Author
Uestc
SOURCE2016 Chinese College Student Program design Contest-Network tryouts CCPC's online race was abused, and the rest of the water couldn't be done.and to refuel .
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include < queue> #include <vector> #include <iomanip> #include <math.h> #include <map>using namespace STD; #define FIN freopen ("Input.txt", "R", stdin), #define FOUT freopen ("Output.txt", "w", stdout); #define INF 0x3f3f 3f3f#define infll 0x3f3f3f3f3f3f3f#define Lson l,m,rt<<1#define rson m+1,r,rt<<1|1typedef Long Long LL typedef pair<int,int> PII;CONST int MAXN = 10000005;char s[maxn];int check (char s[], int mod) {//number as polynomial and For example, 12345 is 1*10^5+2*10^4+3*10^3+4*10^2+5*10^1//first to calculate the number of modules and separate and then together to find the result is the same as LL sum = 0; int len = strlen (s); for (int i = 0; i < len; i++) {sum = sum*10 + s[i]-48; Sum%= mod; } return sum;} int main () {//fin int cas = 1; while (~SCANF ("%s", s)) {if (check (s, 137) = = 0 && Check (s, i) = = 0) printf ("Case #%d:yes\n", cas++); else printf ("Case #%D:no\n ", cas++); }}
HDU 5832 A Water problem large number of surplus