Codeforces Round #311 (Div. 2)A Ilya and Diplomas

【比赛链接】click here~~

【题目大意】

n个人,获取一到三等文凭,每门文凭有大小范围。求最后文凭各颁发多少

【解题思路】直接枚举了,

看完题,赶紧写了一发代码,发现竟然错过注冊时间。系统提示不能提交代码。真是醉了~~。以后还是得提前注冊:

A题,比較简单:

我去,昨天发的代码早上交上去竟然WA了,简直打脸~~

更新一下代码哭

代码:

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    int a1,a2;
    int b1,b2;
    int c1,c2;
    while(cin>>n)
    {
        cin>>a1>>a2;
        cin>>b1>>b2;
        cin>>c1>>c2;
        int max1,max2,max3;
        max1=min(n-b1-c1,a2);
        max2=min(n-max1-c1,b2);
        max3=n-max1-max2;
        cout<<max1<<" "<<max2<<" "<<max3<<endl;
    }
    return 0;
}
/*
6
1 5
2 6
3 7
output
1 2 3
input
10
1 2
1 3
1 5
output
2 3 5
input
6
1 3
2 2
2 2
output
2 2 2
*/


原文地址:https://www.cnblogs.com/blfbuaa/p/7141694.html