[2016-04-16] [URAL] [2068] [Game of Nuts]

Source: Internet
Author: User

    • Time: 2016-04-16-20:19:26 Saturday
    • Title Number: [2016-04-16][ural][2068][game of Nuts]
    • The main idea: given n heap containing odd number of stones, each time the stone into 4 parts, each request is odd, finally can not divide the loss, ask the last who wins
    • Analysis:
      • Odd number of numbers, as long as it is not 1 will be able to decompose,
      • The number is 2XK + 1 gravel heap, total can decompose k times
      • Calculate the total decomposition number directly and judge the parity
  
 
  1. #include<cstdio>
  2. using namespace std;
  3. int main(){
  4. int n,tmp,ans = 0;
  5. scanf("%d",&n);
  6. for(int i = 0 ; i < n ; ++i){
  7. scanf("%d",&tmp);
  8. ans += (tmp - 1) / 2;
  9. }
  10. puts(ans & 1 ?"Daenerys":"Stannis");
  11. return 0;
  12. }


From for notes (Wiz)

[2016-04-16] [URAL] [2068] [Game of Nuts]

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.