zoukankan      html  css  js  c++  java
  • Round #425 A. 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 wi

     1 #include <iostream>
     2 #include <stdio.h>
     3 using namespace std;
     4 typedef long long int ll;
     5 int main(){
     6     ll n,k;
     7     scanf("%I64d%I64d",&n,&k);
     8     ll a=n/k;      //╥жаяЁи╪╦╦Ж
     9     if(a%2==0)  printf("NO
    ");
    10     else printf("YES
    ");
    11 }
    12 /*
    13 WA Test3
    14 #include <iostream>
    15 #include <stdio.h>
    16 using namespace std;
    17 
    18 int main(){
    19     long long a,k;
    20     scanf("%I64d%I64d",&a,&k);
    21     if(a%k==0)  printf("YES");
    22     else printf("NO");
    23     return 0;
    24 }
    25 */
  • 相关阅读:
    使用eclipse阅读java源码
    找重复值
    mysql获取表中数据行数
    DBArtist之Oracle入门第2步: 了解Oracle的Database Control
    DBArtist之Oracle入门第1步: 如何安装Oracle 11g
    存储过程中使用事务和try catch
    Mysql设置auto_increment_increment和auto_increment_offset
    SQL SERVER性能优化综述
    Sql Server 2008R2 数据库发布与订阅
    无法修改SQL Server 服务名称
  • 原文地址:https://www.cnblogs.com/z-712/p/7307988.html
Copyright © 2011-2022 走看看