CodeForce 832A Sasha and Sticks

本文介绍了一个简单的二人游戏SashaandSticks的胜负判断算法。游戏中,两名玩家轮流划掉一定数量的棍子,先手玩家Sasha若能比后手玩家Lena多完成一轮则获胜。文章通过示例解释了如何根据初始棍子数量和每轮划掉的棍子数来判断Sasha是否能胜出。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A. Sasha and Sticks
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
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

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>

using namespace std;
typedef long long int LL;
LL k,n;
int main()
{
    scanf("%lld%lld",&k,&n);
    LL ans=k/n;
    if(ans&1)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

转载于:https://www.cnblogs.com/dacc123/p/8228523.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值