Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
1203 | Kevin Jiang | 13求1+2-3+4-5+……n的值 | C++ | Compile Error | 0 MS | 0 KB | 181 | 2023-08-22 11:51:51 |
#include<iostream> using namespace std; int main(){ int a=0; cin>>a; if(a==0) cout<<0; else if(a&2==0) cout<<3+(a-2)/2; else cout<<1-(a-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: At global scope: Main.cc:12:2: error: expected unqualified-id before 'return' return 0; ^ Main.cc:13:1: error: expected declaration before '}' token } ^