这个题要分情况讨论:
就是当k>=n时,first一定赢;
当k==1时,当k为奇数时,first赢,反则second赢;
当k<n&&k!=1一定是second赢,因为每次无论first怎么取,second一定可以使之对称并且是偶数个;
那么second一定会赢;
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
#include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> #include<queue> #include<set> #include<map> #include<cstring> #include<vector> #include<string> #define LL long long using namespace std; int main( ) { int n,k,T; scanf( "%d",&T ); for( int i = 1; i <= T; i ++ ) { scanf( "%d %d",&n,&k ); printf( "Case %d: ",i ); if( k >= n ||( k == 1 && n % 2 == 1 ) ) puts( "first" ); else puts( "second" ); } //system( "pause" ); return 0; }