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