Educational Codeforces Round 88 (Rated for Div. 2) A. Berland Poker

Posted kanoon

tags:

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

题目链接:https://codeforces.com/contest/1359/problem/A

题解

先给第一个人分配尽可能多的牌,其余的牌数对其他人取下整是平均分的话一个人最少有多少张牌,取上整是平均分的话一个人最多有多少张牌,本题取上整。

代码

#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n, m, k; cin >> n >> m >> k;
    int a = min(m, n / k);
    int b = (m - a + k - 2) / (k - 1);
    cout << a - b << "
";
}

int main() {
    int t; cin >> t;
    while (t--) solve();
}

 

以上是关于Educational Codeforces Round 88 (Rated for Div. 2) A. Berland Poker的主要内容,如果未能解决你的问题,请参考以下文章

Educational Codeforces Round 7 A

Educational Codeforces Round 7

Educational Codeforces Round 90

Educational Codeforces Round 33

Codeforces Educational Codeforces Round 54 题解

Educational Codeforces Round 27