您的位置:首页 > 其它

【bzoj1113】[Poi2008]海报PLA

2014-06-04 19:57 225 查看
#include<iostream>
#include<cstdio>
#include<stack>
using namespace std;
int n,a,ans;
stack<int> s;
inline int read(){
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x*=10;x+=ch-'0';ch=getchar();}
return x*f;
}
int main(){
n=read();
for(int i=1;i<=n;i++){
a=read();a=read();
while(!s.empty()&&a<=s.top()){
if(a==s.top())ans++;
s.pop();
}
s.push(a);
}
printf("%d",n-ans);
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: