| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 138665 | 鄢晨曦 | 13求1+2-3+4-5+……n的值 | C++ | Compile Error | 0 MS | 0 KB | 202 | 2025-11-29 13:40:09 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,sum=1; cin>>n; for(int i;i<=2;i++){ if(i%2==1){ sum1-=i; } else{ sum1+=i; } } cout<<sum1; return 0; }
Main.cc: In function 'int main()':
Main.cc:8:4: error: 'sum1' was not declared in this scope
sum1-=i;
^
Main.cc:11:4: error: 'sum1' was not declared in this scope
sum1+=i;
^
Main.cc:14:8: error: 'sum1' was not declared in this scope
cout<