| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 1202 | Kevin Jiang | 13求1+2-3+4-5+……n的值 | C++ | Compile Error | 0 MS | 0 KB | 181 | 2023-08-22 11:51:26 |
#include<iostream> using namespace std; int main(){ int a=0; cin>>a; if(a==0) cout<<0; else if(a&2==0) cout<<3+(n-2)/2; else cout<<1-(n-1)/2; } return 0; }
Main.cc: In function 'int main()':
Main.cc:7:11: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
else if(a&2==0)
^
Main.cc:8:12: error: 'n' was not declared in this scope
cout<3+(n-2)/2;
^
Main.cc:10:12: error: 'n' was not declared in this scope
cout<<1-(n-1)/2;
^
Main.cc: At global scope:
Main.cc:12:2: error: expected unqualified-id before 'return'
return 0;
^
Main.cc:13:1: error: expected declaration before '}' token
}
^