Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- ios_base::sync_with_stdio(false);
- int amount_of_numbers_1st, amount_of_numbers_2nd, amount_of_numbers_3rd;
- int amount_of_successful_numbers=0;
- int **numbers = new int*[3];
- cin>>amount_of_numbers_1st;
- numbers[0] = new int[amount_of_numbers_1st];
- for(int i=0; i<amount_of_numbers_1st; i++)
- cin>>numbers[0][i];
- cin>>amount_of_numbers_2nd;
- numbers[1] = new int[amount_of_numbers_2nd];
- for(int i=0; i<amount_of_numbers_2nd; i++)
- cin>>numbers[1][i];
- cin>>amount_of_numbers_3rd;
- numbers[2] = new int[amount_of_numbers_3rd];
- for(int i=0; i<amount_of_numbers_3rd; i++)
- cin>>numbers[2][i];
- int j=0, k=0, i=0;
- start_of_1st:
- while(i<amount_of_numbers_1st)
- while(j<amount_of_numbers_2nd)
- {
- if(numbers[0][i] > numbers[1][j])
- j++;
- else
- if(numbers[0][i] == numbers[1][j])
- ///////////////////////////////////////////////
- while(k<amount_of_numbers_3rd)
- {
- if(numbers[0][i] > numbers[2][k])
- k++;
- else
- if(numbers[0][i] == numbers[2][k])
- {
- amount_of_successful_numbers++;
- i++; k++; j++; goto start_of_1st;
- }
- else
- {i++; j++; goto start_of_1st;}
- }
- /////////////////////////////////////////////////
- else
- {i++; goto start_of_1st;}
- }
- cout<<amount_of_successful_numbers;
- return 0;
- }
Add Comment
Please, Sign In to add comment