• Codeforces 832A. Sasha and Sticks


    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 ≤ 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.

    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.

     1 #include <iostream>
     2 #include <stdio.h>
     3 #include <cstring>
     4 #include <algorithm>
     5 using namespace std;
     6 #define ll long long
     7 int main()
     8 {
     9     ll n,k;
    10     while(cin>>n>>k){
    11         ll a=n/k;
    12         if(a%2==0) cout<<"NO"<<endl;
    13         else cout<<"YES"<<endl;
    14     }
    15     return 0;
    16 }
  • 相关阅读:
    [转]在滴滴和头条干了 2 年后端开发,太真实…
    美团DB数据同步到数据仓库的架构与实践学习
    趣头条实时平台架构
    Spark Web UI 监控详解
    前端框架Vue入门
    Spark on Yarn详解
    Spark原理及关键技术点
    Flink应用程序结构开发介绍
    如何进行Flink项目构建,快速开发Flink应用程序?
    机器学习基础
  • 原文地址:https://www.cnblogs.com/wydxry/p/7240547.html
Copyright © 2020-2023  润新知