Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
93247 潘允晨 13求1+2-3+4-5+……n的值 Python3 Accepted 39 MS 3756 KB 110 2024-10-13 08:53:36

Tests(10/10):


Code:

n=int(input()) s=1 for x in range(2,n+1): if x%2==1: s=s-x else: s=s+x print(s)