Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
75680 陈昊然 13求1+2-3+4-5+……n的值 C++ Wrong Answer 0 MS 272 KB 202 2024-05-28 19:02:36

Tests(0/10):


Code:

#include <bits/stdc++.h> using namespace std; int main (){ int a,j=1,o=0; cin>>a; for(int i=1;i<=a;i++){ if (i%2==0){ o=o+i; }else{ j=-i; } } cout<<j+o; return 0; }


Run Info:

------Input------
157
------Answer-----
-77
------Your output-----
6005