Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <queue>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. struct estrutura {
  8.     int x;
  9.     bool operator < (const estrutura &e) const {
  10.         return x < e.x;
  11.     }
  12. };
  13.  
  14. int main() {
  15.     priority_queue <estrutura> Q;
  16.     for (int i = 0; i < 10; i++) {
  17.         estrutura e;
  18.         e.x = (i * 23) % 51;
  19.         Q.push(e);
  20.     }
  21.     while (!Q.empty()) {
  22.         estrutura e = Q.top();
  23.         Q.pop();
  24.         printf("-> %d\n", e.x);
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement