Advertisement
brospresident

problema_domino

Nov 7th, 2018
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include    <iostream>
  2. #include    <fstream>
  3.  
  4. using namespace std;
  5. const int NMAX = 99999;
  6. int x[NMAX], y[NMAX], n;
  7.  
  8. ifstream f("proiect_domino.in");
  9.  
  10. void input(){
  11.     f >> n;
  12.     for(int i = 0; i < n; ++i) f >> x[i];
  13.     for(int i = 0; i < n; ++i) f >> y[i];
  14.     f.close();
  15. }
  16.  
  17. void dynamic(){
  18.     for(int i = 0; i < n - 1; ++i){
  19.         for(int j = i + 1; i < n; ++j){
  20.             if(x[i] == y[j]) cout << x[i]<< " " << y[j] << "\n";
  21.         }
  22.     }
  23.  
  24. }
  25.  
  26. int main()
  27. {
  28.     input();
  29.     dynamic();
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement