J.单挑(ACM实验室新生赛)

如果n为奇数,k为奇数,LZC先手一定拿剩下k+1,LZC赢,k为偶数,LZC拿剩下k,LZC赢。

如果n为偶数,k为n-1,LZC先手只能拿1,HGL赢

#include<cstdio>
#include<iostream>
using namespace std;
 int n,m;
 int a[10010],b[10010];
 int main()
 {
     cin>>n;
     if(n%2)
     {
         cout<<"-1"<<endl;
     }
     else
         cout<<n-1<<endl;
 }
 

发表回复