POJ 2484-A Funny Game (symmetric Game)

Source: Internet
Author: User

POJ 2484-A Funny Game (symmetric Game)

Question link: Click the open link

Question: n numbers are numbered 1-n in a ring. Two people take turns and can only take two adjacent rings or only one ring at a time.

Consider such a problem. If it is not a ring but a line, that is, from 1-N to a line, the first hand can take two or one of the middle to form equal numbers (symmetric between left and right ), then the first hand will be able to stand undefeated (simply put, no matter which side the opponent takes, the first hand will be able to win in the same way as the other side ).

However, this problem is a ring. In special cases, when the ring length is less than 3, the first hand will win (directly remove all), but greater than or equal to 3, any one of them can break the ring into a line (chain). Then, because the first hand wins the line, the answer to this question is "first hand wins.

#include #include 
 
  #include 
  
   #include 
   
    #include 
    
     #include 
     
      #include 
      
       #include 
       
        #include 
        
         #include 
         
          #include 
          
           #include 
           #include 
            
             #define maxn 10000002#define _ll __int64#define ll long long#define INF 0x3f3f3f3f#define Mod 10000007#define pp pair
             
              #define ull unsigned long longusing namespace std;int n;int main(){while(scanf("%d",&n)&&n){ if(n<3)puts("Alice");else puts("Bob");}return 0;}
             
            
          
         
        
       
      
     
    
   
  
 


Related Article

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.