Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- typedef unsigned int uint;
- uint n, a, b;
- uint binarySearch()
- {
- uint x = a + b;
- while (x > 1)
- {
- x = (x + 1) / 2;
- //cout << x << endl;
- if (a / x + b / x >= n) {
- if (a < x) return a;
- return x;
- }
- }
- return x;
- }
- int main() {
- ios::sync_with_stdio(false);
- cin >> n >> a >> b;
- if (a > b)
- swap(a, b);
- cout << binarySearch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement