Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7593 | 余立涵 | 13求1+2-3+4-5+……n的值 | C++ | Wrong Answer | 0 MS | 256 KB | 219 | 2025-05-03 20:55:48 |
#include<bits/stdc++.h> using namespace std; int main(){//单:1-(n-1)/2 双:2+n/2 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