您的位置:首页 > 大数据 > 人工智能

poj 2709 贪心 painter

2014-07-16 15:59 253 查看
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
int n;
int gray,color[1001];
while(scanf("%d",&n)!=EOF)
{
if(n==0) break;
for(int i=0;i<n;i++)
scanf("%d",&color[i]);
scanf("%d",&gray);
sort(color,color+n);
while(gray--)
{
color[0]++;
color[1]++;
color[2]++;
sort(color,color+n);

}
sort(color,color+n);
int max=color[n-1];
int ans=(max%50==0)? (max/50):(max/50+1);
printf("%d\n",ans);
}

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: