A11167 | Sasha and Sticks
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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<=10^{18}$ , $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).
You can print each letter in arbitrary case (upper of lower).
输入输出样例
输入 #1
1 1
输出 #1
YES
输入 #2
10 4
输出 #2
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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted