← Back to List

25592번: 바둑돌 게임 ↗

Solutions

Python 3
179 B | 179 chars
n = int(input())

sm = 0
crt = 1

while sm < n:
    sm += crt
    crt += 1

if crt % 2 == 0:
    print(sm - n)
else:
    if sm == n:
        print(crt)
    else:
        print(0)