Bzoj2056gift? High accuracy? *

Source: Internet
Author: User

Bzoj2056gift? High accuracy?

Test instructions

Give Abcdefghi, Beg 2^a+2^b+2^c+2^d+2^e+2^f+2^g+2^h+i. a~h≤60,i≤2^63

Exercises

Found only the limit data will explode unsigned long long, so let i-1, and then add them up, found that this data is the limit data personal overdraft calculate 2^64 output string, otherwise directly +1 can.

Note that when you calculate the n power of 2 to 1LL<<n, and unsigned long long output to%llu.

Code:

1#include <cstdio>2#include <cstring>3#include <algorithm>4 #defineInc (I,J,K) for (int i=j;i<=k;i++)5 using namespacestd;6 7UnsignedLong Longa[Ten];intT;8 intMain () {9scanf"%d",&t);Ten      while(t--){ OneInc (I,0,8) scanf ("%llu", &a[i]); a[9]=0; A         if(a[8]==0){ -Inc (I,0,7) a[9]+= (1ll<<a[i]); printf"%llu\n", a[9]); -}Else{ thea[8]--; Inc (I,0,7) a[9]+= (1ll<<a[i]); a[9]+=a[8]; -             if(a[9]==18446744073709551615) printf ("18446744073709551616\n");Elseprintf"%llu\n", a[9]+1); -         } -     } +     return 0; -}

20160810

Bzoj2056gift? High accuracy? *

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.