Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- #include <cmath>
- using namespace std;
- int main()
- {
- priority_queue < int > kolejka;
- int liczba = 0;
- while(cin >> liczba != 0);
- {
- if(liczba == 0)
- {
- return 0;
- }
- if(liczba > 0)
- {
- kolejka.push(liczba);
- }
- if(liczba < 0 && !kolejka.empty())
- {
- for(int i = 0; i < -liczba ; i++)
- {
- if(kolejka.empty())
- {
- return 0;
- }
- if(i = 0)
- {
- cout<<kolejka.top();
- }
- else{
- cout <<" "<<kolejka.top();
- kolejka.pop();
- }
- }
- cout<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement