Iamtui1010

lost_rectangle

Dec 1st, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3.  
  4. #define long long long
  5. #define nln '\n'
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     long are;
  12.     cin >> are;
  13.    
  14.     long miv = LLONG_MAX;
  15.     for (long i = round(sqrt(are)); i >= 1; --i)
  16.         if (are % i == 0 && 2*(i + are/i) < miv)
  17.             miv = 2*(i + are/i);
  18.  
  19.     cout << miv << nln;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment