#43642: 總覺得Python的檔案有點大(附程式碼)


210172@vtsh.tc.edu.tw (FlameAndIced)


想問一下有沒有簡單一點的寫法

還是說檔案本來就這麼大

 

我的解:

n = int(input())
wo, wt, ho, ht = map(int, input().split())
wo = wo*wo
wt = wt*wt
fill = map(int, input().split())
best = 0
now = 0
for i in fill:
    if ho>0:
        if i<=wo*ho:
            now = i/wo
            ho = ho-now
        elif i-wo*ho<=wt*ht:
            now = i-wo*ho
            ht = ht-now/wt
            now = now/wt+ho
            ho = 0
        else:
            now = ho+ht
            break
    elif ht>0:
        if i<=wt*ht:
            now = i/wt
            ht = ht-now
        else:
            now = ht
            break
    if now>best:
        best = now
if now>best:
        best = now
print(int(best))