allia

кусок наибольшего

Oct 18th, 2020
513
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cout << "?" << " " << 1 << endl;
  2.   cin >> first_elem;
  3.   cout << "?" << " " << 2 << endl;
  4.   cin >> second_elem;
  5.  
  6.   cout << "?" << " " << n << endl;
  7.   cin >> last_elem;
  8.   cout << "?" << " " << n-1 << endl;
  9.   cin >> pred_last_elem;
  10.  
  11.  
  12.   if (first_elem > second_elem)
  13.    cout << "!" << " " << 1 << endl;
  14.     else if (last_elem > pred_last_elem)
  15.       cout << "!" << " " << n << endl;
RAW Paste Data