he = 0
for n in range(0,100):
if (n % 2 == 0):
he += 2 * n +1
else:
he -= 2 * n + 1
print(he)
代码这样就差不多了
t,a,r=0,1,0
while a<=100:
空if t==0:
空空r,t=r+a,1
空else:
空空r,t=r-a,0
空a+=2
print r
sum = 0
for i in range(1,101):
if (i % 2 == 0):
sum -= 2 * i -1
else:
sum += 2 * i - 1
print(sum)