Advertisement
Infiniti_Inter

queue 74 (7) (IRA)

May 21st, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4. #include <string>
  5. #include <algorithm>
  6. #include <stack>
  7. #include <queue>
  8.  
  9. using namespace std;
  10.  
  11.  
  12. ifstream fin("input.txt");
  13.  
  14.  
  15. int main()
  16. {
  17.     /*
  18.     1 2 2 3 3 3 4 4 4 4
  19.     */
  20.     queue<int> q;
  21.     while (fin.peek() != EOF)
  22.     {
  23.         int cur;
  24.         fin >> cur;
  25.         q.push(cur);
  26.     }
  27.     int last = -1111111;
  28.     while (!q.empty())
  29.     {
  30.         int cur = q.front();
  31.         q.pop();
  32.         if (cur != last || last == -1111111)
  33.             cout << cur << ' ';
  34.         last = cur;
  35.     }
  36.     cout << endl;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement