Guest User

Untitled

a guest
Feb 16th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. ios_base::sync_with_stdio(false);
  7.  
  8. int amount_of_numbers_1st, amount_of_numbers_2nd, amount_of_numbers_3rd;
  9. int amount_of_successful_numbers=0;
  10. int **numbers = new int*[3];
  11.  
  12. cin>>amount_of_numbers_1st;
  13. numbers[0] = new int[amount_of_numbers_1st];
  14. for(int i=0; i<amount_of_numbers_1st; i++)
  15. cin>>numbers[0][i];
  16.  
  17. cin>>amount_of_numbers_2nd;
  18. numbers[1] = new int[amount_of_numbers_2nd];
  19. for(int i=0; i<amount_of_numbers_2nd; i++)
  20. cin>>numbers[1][i];
  21.  
  22. cin>>amount_of_numbers_3rd;
  23. numbers[2] = new int[amount_of_numbers_3rd];
  24. for(int i=0; i<amount_of_numbers_3rd; i++)
  25. cin>>numbers[2][i];
  26.  
  27. int j=0, k=0, i=0;
  28. start_of_1st:
  29. while(i<amount_of_numbers_1st)
  30. while(j<amount_of_numbers_2nd)
  31. {
  32. if(numbers[0][i] > numbers[1][j])
  33. j++;
  34. else
  35. if(numbers[0][i] == numbers[1][j])
  36. ///////////////////////////////////////////////
  37. while(k<amount_of_numbers_3rd)
  38. {
  39. if(numbers[0][i] > numbers[2][k])
  40. k++;
  41. else
  42. if(numbers[0][i] == numbers[2][k])
  43. {
  44. amount_of_successful_numbers++;
  45. i++; k++; j++; goto start_of_1st;
  46. }
  47. else
  48. {i++; j++; goto start_of_1st;}
  49. }
  50. /////////////////////////////////////////////////
  51. else
  52. {i++; goto start_of_1st;}
  53. }
  54. cout<<amount_of_successful_numbers;
  55. return 0;
  56. }
Add Comment
Please, Sign In to add comment