题解 | #牛牛学数列#
牛牛学数列
http://www.nowcoder.com/practice/0b97367cd2184c12a0e02f7c223aee11
n = int(input())
ji = 0
ou = 0
for i in range(1, n+1):
if i % 2 == 0:
ou += i
else:
ji += i
print(ji-ou)
牛牛学数列
http://www.nowcoder.com/practice/0b97367cd2184c12a0e02f7c223aee11
n = int(input())
ji = 0
ou = 0
for i in range(1, n+1):
if i % 2 == 0:
ou += i
else:
ji += i
print(ji-ou)
相关推荐