#53720: C解


calledhxx@gmail.com (Hxx)

學校 : 不指定學校
編號 : 288269
來源 : [111.241.174.79]
最後登入時間 :
2025-09-27 14:40:22

```c
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int
FillingTimes = 0,
w1 = 0,
w2 = 0,
h1 = 0,
h2 = 0;


scanf("%d", &FillingTimes);
scanf("%d", &w1);
scanf("%d", &w2);
scanf("%d", &h1);
scanf("%d", &h2);

unsigned highest = 0;

for (unsigned Index = 0; Index < FillingTimes; Index++)
{
int level = 0;
int water = 0;
scanf("%d", &water);
const int aCube = w1*w1*h1;
const int bCube = w2*w2*h2;

if (water - aCube > 0)
{
level += h1;
water -= aCube;
}
else
{
level += water / (w1*w1);
goto endloop; //不可能再增加
}

if (water - bCube > 0)
level += h2;
else
level += water / (w2*w2);


endloop:

if (level > highest)
highest = level;
}

printf("%d\n", highest);

return 0;
}

```