HDU 5832 A water problem (a water problem)

Source: Internet
Author: User

HDU 5832 A Water Problem ( a water problem )

Time Limit: 5 000/ - xx MS (java/others) Memory limit:65536/65536 K (java/others)

Problem Description-Topic description

The planets named Haha and Xixi in the universe and they were created with the universe beginning.There is the year of Xixi A and 137 days in Haha a. Now your know the day N after Big Bang, you need to answer whether it's the first day in a year about the the-the-first planets .
In the universe there are haha and Xixi two stars, the Hongmeng creation era exists. Xixi 73 days a year, haha 137 days a year now you're told that after the Big Bang, it's been over n days, and you decide if it's the first day of the year for two planets.
CN

Input-Enter

There is several test cases (about 5 huge test cases). for each test, we had a line with an only integer N (0≤n) and the length of n is up to 10000000.
multiple sets of test cases (about 5 extra-large data sets). For each set of test cases, give a row with only one integer n (0≤n) and N to a length of 10000000.
CN

Output-Outputs

For the i-th test case, output case #i: And then output "YES" or "NO" for the answer.

For the I test case, the first output is #i: And then the output answers "YES" or "no".
CN

Sample Input-Enter sample

100010333

Sample output-export example

Case #1: yescase #2: yescase #3: NO

Exercises

Large number modulus

similar to the input hanging reading, but directly according to the input hanging method read a character processing once The IO overhead is too high to time out, and saving into the array before processing can greatly increase the speed.

Code C++

1#include <cstdio>2 #defineMoD 100013 Chardata[10000005];4 intMain () {5     intN, i =0, J;6      while(gets (data)) {7printf"Case #%d:", ++i);8          for(j = n =0; DATA[J]; ++J) n = (n *Ten+ Data[j]-'0') %MoD;9         if(n = =0) puts ("YES");Ten         ElsePuts"NO"); One     } A     return 0; -}


HDU 5832 A water problem (a water problem)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.