pku2709.cpp

来自「这是ACM 方面的资料 是PKU的 北京大学的出来的」· C++ 代码 · 共 37 行

CPP
37
字号
#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 + =
减小字号Ctrl + -
显示快捷键?