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

来源:互联网 发布:二进制算法例子 编辑:程序博客网 时间:2024/05/01 17:26

【比赛链接】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;}/*61 52 63 7output1 2 3input101 21 31 5output2 3 5input61 32 22 2output2 2 2*/


0 0
原创粉丝点击