| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 124013 | 陈梓钒 | 13求1+2-3+4-5+……n的值 | C++ | Wrong Answer | 1 MS | 272 KB | 210 | 2025-07-10 15:56:54 |
#include<bits/stdc++.h> using namespace std; int main(){ int n; int s=0; cin>>n; for(int i=1;i<=n;i++){ if(i==1 || i%2==0){ s += i; } else{ s -+ i; } } cout<<s; return 0; }
------Input------
157
------Answer-----
-77
------Your output-----
6163