ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1068. Sum

Python 3 solution without loops
Posted by ZEMlan 12 Jul 2018 19:15
n = int(input())
if n > 0:
    print(int(n*(n+1)/2))
elif n == 0:
    print('1')
else:
    print(int(n*(n-1)/-2 + 1))



Re: Python 3 solution without loops
Posted by Artem 13 May 2019 00:07
thanks