Codeforces Round #425 A

Posted %%%%%

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #425 A相关的知识,希望对你有一定的参考价值。

Sasha and Sticks

题意:n根棍子,每次拿走k根,当不足k根的时候不能拿,输,判断先手能否赢

思路:(n/k)&1,直接判断能经行奇数次取木棍还是偶数

AC代码:

#include "iostream"
#include "string.h"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "set"
#include "map"
#include "algorithm"
#include "stdio.h"
#include "math.h"
#define ll long long
#define bug(x) cout<<x<<" "<<"UUUUU"<<endl;
#define mem(a) memset(a,0,sizeof(a))
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define lrt (root*2)
#define rrt (root*2+1)
#define len (r-l+1)
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const long long INF = 1e18+1LL;
const int inf = 1e9+1e8;
const int N=1e5+100;
const ll mod=1e9+7;

ll n,k;
int main(){
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>n>>k;
    ll ans=n/k;
    if(ans&1) cout<<"YES";
    else cout<<"NO";
    return 0;
}

 

以上是关于Codeforces Round #425 A的主要内容,如果未能解决你的问题,请参考以下文章

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

Codeforces Round #425 (Div.2)

Codeforces Round #425 B

Codeforces Round #425 (Div. 2) D 树链剖分 + 树状数组维护区间

Codeforces Round #425 (Div. 2) Problem C (Codeforces 832C) Strange Radiation - 二分答案 - 数论

Codeforces Round #425 (Div. 2) Problem B Petya and Exam - 暴力