HDU 3389 Ladder Game

Source: Internet
Author: User

Test instructions: 1-n numbered box, when the number satisfies a>b && A non-null && (A + b)% 3 = = 0 && (A + B)% 2 = = 1 can be taken from A
The Italian stone to B, who can not take who will lose.
Alice Initiator

  
Ladder game: The game is carried on a ladder, each ladder is placed on a natural number of points, two people to carry out the ladder game, each step is to a group on a number of points

(>=1) move to the front, and finally there is no point to move the person to lose.


The state of 1,3,4 in the subject cannot be transferred to another State; Each of the other states can be transferred; and location-specific, such as 2->1, 5->4, 6->3, 7->2

, 8->1 9->6,10->5 11->4. 15->6.

11->4 12->3 14->1
17->4 19->3 20->1
...

Position i%6 = = 0 2 5 of these positions can be moved to 1 3 4 This is equivalent to the Nim game in these several positions

Sample Input
2
2
1 2
7
1 3 3 2 2 1 2

Sample Output
Case 1:alice
Case 2:bob

1# include <iostream>2# include <cstdio>3# include <cstring>4# include <algorithm>5# include <string>6# include <cmath>7# include <queue>8# include <list>9# define LLLong LongTen using namespacestd; One  A intMain () - { -     //freopen ("In.txt", "R", stdin); the     intT; -scanf"%d", &T); -     intCase =0 ; -      while(t--) +     { -         intn, x; +         inti; Acase++ ; atprintf"Case %d:", case); -scanf"%d", &n); -         intAns =0 ; -          for(i =1; I <= N; i++) -         { -scanf"%d", &x); in             if(i%6==0|| i%6==2|| i%6==5) -Ans ^=x; to         } +         if(ans = =0) -printf"bob\n") ; the         Else *printf"alice\n") ; $ Panax Notoginseng     } -}
View Code

HDU 3389 Ladder Game

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.