• AtCoder Crackers——水题


    题目描述

    Takahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible. When all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.

    Constraints
    ·1≤N,K≤100
    ·All values in input are integers.

    输入

    Input is given from Standard Input in the following format:
    N K

    输出

    Print the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.

    样例输入

    7 3

    样例输出

    1

    提示

    When the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.

    虽然是水题,但还是先解释一波
    能够整除的情况下,就是0,不能整除的情况下就是1
    代码:

    #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
    #pragma GCC optimize("Ofast")
    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #pragma comment(linker, "/stack:200000000")
    #pragma GCC optimize (2)
    #pragma G++ optimize (2)
    #include <bits/stdc++.h>
    #include <algorithm>
    #include <map>
    #include <queue>
    #include <set>
    #include <stack>
    #include <string>
    #include <vector>
    using namespace std;
    #define wuyt main
    typedef long long ll;
    #define HEAP(...) priority_queue<__VA_ARGS__ >
    #define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
    template<class T> inline T min(T &x,const T &y){return x>y?y:x;}
    template<class T> inline T max(T &x,const T &y){return x<y?y:x;}
    //#define getchar()(p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
    //char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
    ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();
    if(c == '-')Nig = -1,c = getchar();
    while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();
    return Nig*x;}
    #define read read()
    const ll inf = 1e15;
    const int maxn = 2e5 + 7;
    const int mod = 1e9 + 7;
    #define start int wuyt()
    #define end return 0
    start{
        int n=read,k=read;
        if(n%k==0) printf("0
    ");
        else printf("1
    ");
        end;
    }
    
  • 相关阅读:
    关于文件路径的生成
    re模块小结
    logging模块知识点及应用小结
    微信小程序上传图片
    小程序图表插件
    小程序实现多图上传、预览
    微信小程序实现验证码倒计时效果
    微信小程序上传图片,视频及预览
    小程序实现星级打分
    小程序获取系统日期时间
  • 原文地址:https://www.cnblogs.com/PushyTao/p/13144204.html
Copyright © 2020-2023  润新知