[ACM Timus] 1068. Sum [Python]

Problem Link: 1068. Sum

 
[python]
a=int(input())
if a>0:
print(int(a*(a+1)/2))
else:
c=-a
print(int(1-c*(c+1)/2))
[/python]

Advertisements