Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. for (int i = 0; i < size; i++)
  2. {
  3. cin >> array[i];
  4. }
  5. int k;
  6. cin >> k;
  7. int asd;
  8. for (int i = 0; i < k ; ++i) {
  9. value = 0;
  10. cin >> key;
  11. index = Search_Binary (array, 0, size, key);
  12. for (int j = 0; j < size; ++j) {
  13.  
  14. if (array[index] == array[index+1]){
  15. value++;
  16. }
  17. }
  18. if (value == 0){
  19. value = -1;
  20. }
  21.  
  22. cout << index << " " << value;
  23. cout << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement