← Back to List

4850번: Baskets of Gold Coins ↗

Solutions

Python 3
189 B | 189 chars
while 1:
    try:
        n, w, d, s = map(int,input().split())
    except:
        break
    z = n * (n - 1) // 2 * w

    if s == z:
        print(n)
    else:
        print((z - s) // d)