标签:codeforces
【比赛链接】click here~~
【题目大意】
n个人,获取一到三等文凭,每门文凭有大小范围,求最后文凭各颁发多少
【解题思路】直接枚举了,
看完题,赶紧写了一发代码,发现居然错过注册时间,系统提示不能提交代码,真是醉了~~,以后还是得提前注册:
A题,比较简单:
代码:
#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=0,max2=0,max3=0;
for(int i=a1;i<=a2;++i)
{
for(int j=b1;j<=b2;++j)
{
for(int k=c1;k<=c2;++k)
{
max1=max(max1,i);
max2=max(max2,j);
max3=max(max3,k);
if(max1+max2+max3==n)
{
cout<<max1<<" "<<max2<<" "<<max3<<endl;
return 0;
}
}
}
}
}
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
*/版权声明:本文为博主原创文章,未经博主允许不得转载。
Codeforces Round #311 (Div. 2)A Ilya and Diplomas
标签:codeforces
原文地址:http://blog.csdn.net/u013050857/article/details/46702621