当前位置: 首页 > 工具软件 > Crackers > 使用案例 >

D - AtCoder Crackers

江德海
2023-12-01

D - 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
Input is given from Standard Input in the following format:

N K

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

Sample Input 1
7 3

Sample Output 1
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.

Sample Input 2
100 10

Sample Output 2
0
The crackers can be distributed evenly.

Sample Input 3
1 1

Sample Output 3
0

代码:

#include <bits/stdc++.h>
using namespace std;
int n,k;
int main()
{
    cin>>n>>k;
    if(n%k==0)
        cout<<0;
    else
        cout<<1;
    return 0;
}
 类似资料: