n个硬币围成一个环 每次只能取1-K个硬币 最后取完者胜
假如5个硬币 每次取1-2个
情况1 先手取1个 后手取剩下4个中间2个 破坏了连续 虽然最后剩2个,但先手只能取一个 然后后再取一个 后手胜
情况2 先手取2个 后手取剩下3个中间的那1个 然后同理 后手胜
Sample Input
2
3 1//n k
3 2
Sample Output
Case 1: first
Case 2: second
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 LL long long 10 using namespace std ; 11 12 int main() 13 { 14 int T ; 15 scanf("%d" , &T) ; 16 int Case = 0 ; 17 while(T--) 18 { 19 int n , k ; 20 Case++ ; 21 scanf("%d %d" , &n , &k) ; 22 printf("Case %d: " , Case) ; 23 if (k == 1 && n%2 == 1) 24 printf("first ") ; 25 else if (k >= n) 26 printf("first ") ; 27 else 28 printf("second ") ; 29 } 30 }