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;
}

 

posted on 2017-07-26 19:54  lazzzy  阅读(110)  评论(0编辑  收藏  举报

导航