从n个石子中每次取p~q个,求先手能否获胜

可以先列举一部分数据,然后观察可得总是在p+q中循环,所以只要用n对p+q取模就好了

 

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int p,q;

int main()
{
  //  freopen("a.in" , "r" , stdin);
    int n;
    while(scanf("%d%d%d" , &n , &p , &q) == 3)
    {
        int mod = n%(q+p);
        if(mod>=1 && mod<=p) puts("LOST");
        else puts("WIN");
    }
    return 0;
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
  • 2021-06-27
  • 2022-12-23
  • 2021-06-27
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2021-12-20
  • 2022-03-03
  • 2022-12-23
  • 2021-12-21
  • 2021-06-17
相关资源
相似解决方案