Online Judge
Toggle navigation
C++题库系统 OJ
首页
问题列表
状态
排行榜
登录
首页
状态
93250
Run ID
作者
问题
语言
测评结果
Time
Memory
代码长度
提交时间
93250
潘允晨
13求1+2-3+4-5+……n的值
Python3
Accepted
40 MS
3756 KB
127
2024-10-13 09:03:28
Tests(10/10):
Code:
n=int(input()) s=1 i=2 while i<=n: if i%2==0: s=s+i else: s=s-i i=i+1 print(s)