Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- long long solve(long long a) {
- long long l = 0, r = 1e9 + 1;
- while (l < r - 1) {
- long long m = (l + r) / 2;
- if (m * m <= a)
- l = m;
- else
- r = m;
- }
- return l;
- }
- int main()
- {
- long long a;
- cin >> a;
- cout << solve(a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement