zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    crypto 密码加密
    -webkit-box 高度自动填满
    performance数据
    AJAX
    Javascript sort方法
    Javascript reduce方法
    如何让div内的多行文本上下左右居中
    js基础
    for循环的执行顺序
    json对象和json字符串
  • 原文地址:https://www.cnblogs.com/max88888888/p/7241618.html
Copyright © 2011-2022 走看看