⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pku2709.cpp

📁 这是ACM 方面的资料 是PKU的 北京大学的出来的
💻 CPP
字号:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int cp(const void *a, const void *b)
{
	return *(int *)a - *(int *)b;
}

int main()
{
	int N, i;
	int col[13], max, gray;
	while (scanf("%d", &N) != -1 && N > 0)
	{
		for (i = 0; i < N; i++)
		{
			scanf("%d", col + i);
		}
		scanf("%d", &gray);
		qsort(col, N, sizeof(col[0]), cp);
		max = col[N - 1];
		while (gray > 0)
		{
			col[0]++;
			col[1]++;
			col[2]++;
			gray--;
			qsort(col, N, sizeof(col[0]), cp);
			max = col[N - 1];
		}
		printf("%d\n", (max + 49) / 50);
	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -