题目:
2 1000 1 1 100
Lose Win
对于此类问题我们可以逆向考虑:如果我先取石子剩下多少个才能使得对方必输,简单点就是:我取后还剩m+1个无论对方怎么取
对方必输。从后向前考虑设置必胜点和必败点,只有我剩下的在m+1的倍数然后让对方站在此处我就必胜了,因为对方无论如何去取我都能最终取完。
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<cstring>
using namespace std;
int a[30],b[30];
int main()
{
	
  int n;
  cin>>n;
  while(n--)
  {
    int x,y;
    cin>>x>>y;
    if(x%(y+1)){
    cout<<"Win"<<endl;
    }else{
      cout<<"Lose"<<endl;
    }
  } 
	
  return 0;
} 
 
原文:http://www.cnblogs.com/zhihaospace/p/6290935.html