"HDU 5832" A water problem (large number modulo)

Source: Internet
Author: User
Tags cas modulus

10 million the number of lengths to 73 and 137 modulo. (two numbers a bit like, don't write wrong)

If the efficiency is high, the modulus is taken every 15 bits, because there may be 3 bits after the modulus, so it will take up to 15 bits at a time with LL.

A model can also be used, but slower, the modulo operation is a time-consuming operation.

#include <cstdio> #define LL long LONGLL n,m;int P,cas;char s[10000005];int main () {while (gets (s)) {N=m=p=0;while (s [P]) {for (int i=0;i<15&&s[p];i++,p++) {n=n*10+s[p]-' 0 '; m=m*10+s[p]-' 0 ';} n%=73;m%=137;} printf ("Case #%d:", ++cas); if (n| | m) puts ("NO"); else puts ("YES");}}

  

"HDU 5832" A water problem (large number modulo)

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.