POJ 1704-Georgia and Bob (Tiered game)

Source: Internet
Author: User

POJ 1704-Georgia and Bob (Tiered game)

 

N pawns are distributed on the x-axis. Now the two move the pawns to the left in turn. They must not cross the border when they encounter other pawns (they cannot be moved to the negative half-axis.

It is equivalent to a tiered game. For example, if 5 moves to the left to 3 (2 cells are moved), the range of 7 moves increases by two cells.

For more information about the tiered game, click here.

Note: the rightmost step is equivalent to 1, not the leftmost step. (Because it always moves to the left) and this question should be sorted...

 

#include #include 
 
  #include 
  
   #include 
   
    #include 
    
     #include 
     
      #include 
      
       #include 
       
        #include 
        
         #include 
         
          #include 
          
           #include
           #include 
            
             #define maxn 1002#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,a[maxn];void solve(){a[0]=0;int tem=0;for(int i=1;i<=n;i++){scanf(%d,a+i);}sort(a,a+n+1);for(int i=n;i>=1;i-=2){int d=a[i]-a[i-1]-1;tem^=d;}if(tem)puts(Georgia will win);else puts(Bob will win);}int main(){int T;scanf(%d,&T);while(T--){scanf(%d,&n);solve();}return 0;}
             
            
          
         
        
       
      
     
    
   
  
 


 

 

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.