foo.cc: In function 'void init()':
foo.cc:5:32: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int n,s,a[10000],x=1,y=n,mid=x+y>>1;
~^~
foo.cc:5:27: warning: unused variable 'mid' [-Wunused-variable]
int n,s,a[10000],x=1,y=n,mid=x+y>>1;
^~~
foo.cc: In function 'void qwe()':
foo.cc:13:12: error: 'n' was not declared in this scope
int x=1,y=n,mid=x+y>>1;
^
foo.cc:16:9: error: 'a' was not declared in this scope
if(a[x]==s)
^
foo.cc:16:15: error: 's' was not declared in this scope
if(a[x]==s)
^
foo.cc:21:9: error: 'a' was not declared in this scope
if(a[mid]==s)
^
foo.cc:21:11: error: 'mid' was not declared in this scope
if(a[mid]==s)
^~~
foo.cc:21:17: error: 's' was not declared in this scope
if(a[mid]==s)
^
foo.cc:31:1: error: expected initializer before '}' token
}
^
foo.cc: At global scope:
foo.cc:32:12: error: expected constructor, destructor, or type conversion before ';' token
init();
^
foo.cc:33:7: error: expected constructor, destructor, or type conversion before ';' token
qwe();
^
foo.cc:34:5: error: expected unqualified-id before 'if'
if(a[mid]!=s) cout<<-1;
^~
foo.cc:35:5: error: expected unqualified-id before 'return'
return 0;
^~~~~~
foo.cc:36:1: error: expected declaration before '}' token
}
^
自豪的采用 HydroJudge 进行评测(github.com/hydro-dev/HydroJudge)