Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define int long long
  3. using namespace std;
  4.  
  5. int32_t main()
  6. {
  7. int n;
  8. cin >> n;
  9. int a = sqrt(n);
  10. if(a * a == n)
  11. cout << n;
  12. else
  13. {
  14. a ++;
  15. if(a == 1000000001)
  16. {
  17. cout << 1000000000000000000;
  18. return 0;
  19. }
  20. if(n <= (a - 1) * (a - 1))
  21. {
  22. cout << (a - 1) * (a - 1);
  23. return 0;
  24. }
  25. if(n > a * a)
  26. {
  27. cout << (a + 1) * (a + 1);
  28. return 0;
  29. }
  30. cout << a * a;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement