formygloryandpeacefulday  

include

using namespace std;

define max 1000000

int main()
{
int number, need, a[max], b[max];
int cut, sum = 0;
cin >> number >> need;
for (int i = 0; i < number; i++)
{
cin >> a[i];
}
for (cut = 0; ; cut++)
{
for (int i = 0; i < number; i++)
{
b[i] = a[i] - cut;
if (cut >= a[i])
{
b[i] = 0;
}

	}
	for (int i = 0; i < number; i++)
	{
		sum = sum + b[i];
	}
	if (sum - need < 0)
	{
		break;
	}
	sum = 0;
}
cout << cut - 1;
return 0;

}

posted on 2024-11-11 18:39  残夏便是结局  阅读(15)  评论(0)    收藏  举报