It's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day he invents some game and plays in it alone or with friends.
Today he invented one simple game to play with Lena, with whom he shares a desk. The rules are simple. Sasha draws n sticks in a row. After that the players take turns crossing out exactly k sticks from left or right in each turn. Sasha moves first, because he is the inventor of the game. If there are less than k sticks on the paper before some turn, the game ends. Sasha wins if he makes strictly more moves than Lena. Sasha wants to know the result of the game before playing, you are to help him.
The first line contains two integers n and k (1 ≤ n, k ≤ 1018, k ≤ n) — the number of sticks drawn by Sasha and the number k — the number of sticks to be crossed out on each turn.
If Sasha wins, print "YES" (without quotes), otherwise print "NO" (without quotes).
You can print each letter in arbitrary case (upper of lower).
1 1
YES
10 4
NO
In the first example Sasha crosses out 1 stick, and then there are no sticks. So Lena can't make a move, and Sasha wins.
In the second example Sasha crosses out 4 sticks, then Lena crosses out 4 sticks, and after that there are only 2 sticks left. Sasha can't make a move. The players make equal number of moves, so Sasha doesn't win.
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
using namespace std;
#define LL long long
#define mem(a,b) memset(a,b,sizeof a)
const int INF = 0x3f3f3f3f;
#define MAXN 100100
#define MAXM 1000100
int main()
{
LL n,m;
while(~scanf("%lld%lld",&n,&m))
{
if((n/m)%2)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}

本文介绍了一个简单的二人游戏——Sasha与棍子游戏。通过分析游戏规则,给出了一种快速判断Sasha是否能赢得游戏的方法。游戏规则简单明了:两名玩家轮流从一排棍子中移除一定数量的棍子,直至无法继续移动为止。
663

被折叠的 条评论
为什么被折叠?



