1. 程式人生 > >HDU 4006: The kth great number

HDU 4006: The kth great number

cout show ace c++ out mil while -a tex

The kth great number

[email protected] Sycamore
[email protected] 8/8/2017
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	while (cin >> n >> k)
	{
		char ch;
		int t;
		multiset<int>s;
		while (n--)
		{
cin >> ch; if (ch == ‘I‘) { cin >> t; s.insert(t); if (s.size() > k)s.erase(s.begin()); } else cout <<*s.begin()<<endl ; } } return 0; }

HDU 4006: The kth great number