SHARE
TWEET

Untitled

a guest Feb 27th, 2020 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("interclasare2.in");
  5. ofstream fout("interclasare2.out");
  6. int v[100000];
  7. int k[100000];
  8. int main()
  9. {
  10. int a,i,x,y,b,maxi=0,cont=0;
  11. fin>>a;
  12. if(maxi<a)
  13.     maxi=a;
  14. for(i=1;i<=a;i++){
  15.     fin>>x;
  16. if(maxi<x)
  17.     maxi=x;
  18.  
  19.     v[x]++;
  20. }
  21. fin>>b;
  22. for(i=1;i<=b;i++){
  23.     fin>>y;
  24. if(maxi<y)
  25.     maxi=y;
  26. k[y]++;
  27. }
  28.  
  29. for(i=0;i<=maxi;i++){
  30. if((v[i]!=0)&&(k[i]!=0)){
  31.     if(cont==10){
  32.     fout<<endl;
  33.     cont=0;
  34.     }
  35.  
  36. fout<<i<<" ";
  37. cont++;
  38.  
  39. }
  40. }
  41.  
  42.     return 0;
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top