-
题目链接:
-
瞎扯
这是今天考的模拟赛T2交互题的一个30分部分分,老师在讲题时提到了这题。考场上我比较菜并没有想出来
-
分析:
一个非常神奇美妙的做法,请大家直接看代码
include
include
template
x=0;int ne=0;char c;
while(!isdigit(c=getchar()))ne=c'-';
x=c-48;
while(isdigit(c=getchar()))x=(x<<3)+(x<<1)+c-48;
x=ne?-x:x;
return ;
}
int n,x,y=-0x7fffffff,tot=0;
int main(){
scanf("%d
",&n);
while(n--){
read(x);
if(xy){
tot++;
}
else if(!tot){
y=x,tot=1;
}
else tot--;
}
printf("%d
",y);
return 0;
}