Codeforces Round #425 (Div. 2) Problem A Sasha and Sticks (Codeforces 832A)

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.

Input

The first line contains two integers n and k (1 ≤ n, k ≤ 1018k ≤ n) — the number of sticks drawn by Sasha and the number k — the number of sticks to be crossed out on each turn.

Output

If Sasha wins, print "YES" (without quotes), otherwise print "NO" (without quotes).

You can print each letter in arbitrary case (upper of lower).

Examples
input
1 1
output
YES
input
10 4
output
NO
Note

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.


  题目大意 桌面上有n根棍子,每次拿k根,两个人交换着拿,当轮到谁时,桌面上的棍子数量少于k根,谁就输。问先手能否获胜。

  一共可以拿轮,判断它的奇偶性就好了。

  在比赛时3分钟a掉这道题,还是比较满意的。

Code

 1 /**
 2  * Codeforces
 3  * Problem#832A
 4  * Accepted
 5  * Time:15ms
 6  * Memory:2000k
 7  */
 8 #include <iostream>
 9 #include <cstdio>
10 #include <ctime>
11 #include <cmath>
12 #include <cctype>
13 #include <cstring>
14 #include <cstdlib>
15 #include <fstream>
16 #include <sstream>
17 #include <algorithm>
18 #include <map>
19 #include <set>
20 #include <stack>
21 #include <queue>
22 #include <vector>
23 #include <stack>
24 #ifndef WIN32
25 #define Auto "%lld"
26 #else
27 #define Auto "%I64d"
28 #endif
29 using namespace std;
30 typedef bool boolean;
31 const signed int inf = (signed)((1u << 31) - 1);
32 const signed long long llf = (signed long long)((1ull << 61) - 1);
33 const double eps = 1e-6;
34 const int binary_limit = 128;
35 #define smin(a, b) a = min(a, b)
36 #define smax(a, b) a = max(a, b)
37 #define max3(a, b, c) max(a, max(b, c))
38 #define min3(a, b, c) min(a, min(b, c))
39 template<typename T>
40 inline boolean readInteger(T& u){
41     char x;
42     int aFlag = 1;
43     while(!isdigit((x = getchar())) && x != '-' && x != -1);
44     if(x == -1) {
45         ungetc(x, stdin);    
46         return false;
47     }
48     if(x == '-'){
49         x = getchar();
50         aFlag = -1;
51     }
52     for(u = x - '0'; isdigit((x = getchar())); u = (u << 1) + (u << 3) + x - '0');
53     ungetc(x, stdin);
54     u *= aFlag;
55     return true;
56 }
57 
58 long long n, k; 
59 
60 inline void init() {
61     readInteger(n);
62     readInteger(k);
63     long long c = n / k;
64     if(c & 1)    puts("YES");
65     else puts("NO");
66 }
67 
68 int main() {
69     init();
70     return 0;
71 }
posted @ 2017-07-25 17:45 阿波罗2003 阅读(...) 评论(...) 编辑 收藏