#44472: Python 實作題1~4題詳解


leeguanhan0909@gmail.com (李冠翰)


 解答 如有問題歡迎在下方詢問。

#44851: Re: Python 實作題1~4題詳解


txw116 (tsai)


 解答 如有問題歡迎在下方詢問。

這樣為甚麼過不了全部測資阿?

n=int(input())
w1,w2,h1,h2=map(int,input().split())
data=list(map(int,input().split()))
now=0
result=[]

 

for i in range(n):
    if now+data[i]>=h1:
        if now+data[i]<=w1*w1*h1:
            result.append(data[i]/w1/w1)
            now+=data[i]
        elif now+data[i]>w1*w1*h1:
            result.append((h1-now/w1/w1)+((data[i]-(h1*w1*w1-now))/w2/w2))
            now+=data[i]
    else:
        result.append(data[i]/w2/w2)
        now+=data[i]

 

print(int(max(result)))