Codeforces 832A. Sasha and Sticks
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 ≤ 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.
If Sasha wins, print "YES" (without quotes), otherwise print "NO" (without quotes).
You can print each letter in arbitrary case (upper of lower).
1 1
YES
10 4
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.
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
using namespace std;
#define ll long long
int main()
{
ll n,k;
while(cin>>n>>k){
ll a=n/k;
if(a%==) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return ;
}
Codeforces 832A. Sasha and Sticks的更多相关文章
- CodeForce 832A Sasha and Sticks
A. Sasha and Sticks time limit per test2 seconds memory limit per test256 megabytes inputstandard in ...
- Codeforces 1109D. Sasha and Interesting Fact from Graph Theory
Codeforces 1109D. Sasha and Interesting Fact from Graph Theory 解题思路: 这题我根本不会做,是周指导带飞我. 首先对于当前已经有 \(m ...
- 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 h ...
- 【Codeforces Round #425 (Div. 2) A】Sasha and Sticks
[Link]: [Description] [Solution] 傻逼题; 获取n/k; 对n/k的奇偶性讨论一下就好 [NumberOf WA] 0 [Reviw] [Code] #include ...
- Codeforces #317 C.Lengthening Sticks(数学)
C. Lengthening Sticks time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces 1109D Sasha and Interesting Fact from Graph Theory (看题解) 组合数学
Sasha and Interesting Fact from Graph Theory n 个 点形成 m 个有标号森林的方案数为 F(n, m) = m * n ^ {n - 1 - m} 然后就 ...
- [CodeForces 471A] MUH and Sticks
题目链接:http://codeforces.com/problemset/problem/471/A 题目数据规模1 - 9,可以用一个数组进行计数,减掉出现四次的数,看看还有几个是非零数,有一个就 ...
- codeforces 572 C. Lengthening Sticks(数学)
题目链接:http://codeforces.com/contest/572/problem/C 题意:给出a,b,c,l要求a+x,b+y,c+z构成三角形,x+y+z<=l,成立的x,y,z ...
- Codeforces 1109F - Sasha and Algorithm of Silence's Sounds(LCT)
Codeforces 题面传送门 & 洛谷题面传送门 讲个笑话,这题是 2020.10.13 dxm 讲题时的一道例题,而我刚好在一年后的今天,也就是 2021.10.13 学 LCT 时做到 ...
随机推荐
- Arm开发板+Qt学习之路
从2015.11.13日开始接触arm开发板,开始学习Qt,到现在已经四个月零17天了,从一个拿到开发板一无所知的小白,到现在能够在开发板上进行开发,有付出有收获. 之前一直没有时间将这个过程中的一些 ...
- C#的多线程简洁笔记
New Thread(()=>{}).Start(); //匿名线程 Thread Ntd = new Thread(T1); Ntd.IsBackground = true; //后台线程 N ...
- [20200223]关于latch and mutext的优化.txt
[20200223]关于latch and mutext的优化.txt --//前一段时间一直在测试使用DBMS_SHARED_POOL.MARKHOT标识热对象以及sql语句的优化.--//有别人问 ...
- Git操作 :从一个分支cherry-pick多个commit到其他分支
在branch1开发,进行多个提交,这时切换到branch2,想把之前branch1分支提交的commit都[复制]过来,怎么办? 首先切换到branch1分支,然后查看提交历史记录,也可以用sour ...
- 为什么选择Spring Boot?
本文概述了各种Spring配置样式,并帮助你了解配置Spring应用程序的复杂性.抽丝剥茧 细说架构那些事——[优锐课] Spring是一个非常流行的基于Java的框架,用于构建Web和企业应用程序. ...
- 并发编程之J.U.C的第二篇
并发编程之J.U.C的第二篇 3.2 StampedLock 4. Semaphore Semaphore原理 5. CountdownLatch 6. CyclicBarrier 7.线程安全集合类 ...
- hadoop学习摘要
参考链接:https://www.zhihu.com/question/333417513 https://www.oschina.net/p/hbase hadoop环境搭建:https://blo ...
- KVM | centos 安装 window 虚拟机
KVM | centos 安装 window 虚拟机 环境: CENTOS 7.3 1. 准备 1.1 检查是否支持虚拟化 cat /proc/cpuinfo | egrep 'vmx|svm' 要求 ...
- vue 注意
Path Intellisense 插件 @路径提醒 配置文件中配置: "path-intellisense.mappings": { "@": "$ ...
- C#开发OPC客户端
第一个随笔,使用了OPEN Live Write,作为客户端.最近使用c#开发一个小软件,主要功能是OPC客户端.以后会开发各类别的协议,作为,协议的转发栈. 因为我本人是搞自动化的,所以搞自动化小伙 ...