Advertisement
velimir

Podaroci

Mar 22nd, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int boxx, boxy, brPodaroci, podarokx, podaroky, i, j=0;
  8.     cin >> boxx >> boxy;
  9.     cin >> brPodaroci;
  10.     int nizax[brPodaroci], nizay[brPodaroci];
  11.     for(i=0; i<brPodaroci; i++)
  12.     {
  13.         cin >> podarokx >> podaroky;
  14.         if(boxx>=podarokx and boxy>=podaroky)
  15.         {
  16.             nizax[j] = podarokx;
  17.             nizay[j] = podaroky;
  18.             j++;
  19.             podarokx = 10001;
  20.             podaroky = 10001;
  21.         }
  22.         if(boxx>=podaroky and boxy>=podarokx)
  23.         {
  24.             nizax[j] = podarokx;
  25.             nizay[j] = podaroky;
  26.             j++;
  27.         }
  28.     }
  29.     cout << j << endl;
  30.     for(i=0; i<j; i++)
  31.     {
  32.         cout << nizax[i] << " " << nizay[i] << endl;
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement