Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7594 | 余立涵 | 13求1+2-3+4-5+……n的值 | C++ | Wrong Answer | 0 MS | 264 KB | 190 | 2025-05-03 20:57:02 |
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; if(n%2==1) {cout<<1-(n-1)<<endl; } if(n%2==0) {cout<<2+n/2<<endl; } return 0; }
------Input------
551
------Answer-----
-274
------Your output-----
-549