Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define int long long
- using namespace std;
- int32_t main()
- {
- int n;
- cin >> n;
- int a = sqrt(n);
- if(a * a == n)
- cout << n;
- else
- {
- a ++;
- if(a == 1000000001)
- {
- cout << 1000000000000000000;
- return 0;
- }
- if(n <= (a - 1) * (a - 1))
- {
- cout << (a - 1) * (a - 1);
- return 0;
- }
- if(n > a * a)
- {
- cout << (a + 1) * (a + 1);
- return 0;
- }
- cout << a * a;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement