toj 2196. Nuanran's Idol II set练习

题目链接:http://acm.tju.edu.cn/toj/showp2196.html

View Code
 1 #include<iostream>
2 #include<cmath>
3 #include<cstring>
4 #include<set>
5 using namespace std;
6 int main()
7 {
8 int i,j,k,n,m,t;
9 char ch;
10 multiset<int>st2;
11 multiset<int>::iterator in2;
12 while (cin>>n,n)
13 {
14 st2.clear();
15 for (i=1;i<=n;i++)
16 {
17 cin>>ch;
18 if(ch=='B')
19 {
20 cin>>m;
21 st2.insert(m);
22 }
23 else {
24 in2=st2.begin();
25 if(in2!=st2.end())
26 {
27 cout<<*in2<<endl;
28 st2.erase(in2);
29 }
30 }
31 }
32 }
33 return 0;
34 }



posted @ 2012-03-09 07:42  我们一直在努力  阅读(254)  评论(0编辑  收藏  举报