SHARE
TWEET

Untitled

a guest Mar 24th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from math import sqrt
  2.  
  3. inp = open('input.txt')
  4. data = int(inp.readline())
  5. inp.close()
  6.  
  7. result = 0
  8. multiplied = []
  9. for x in range(1, int(sqrt(data) + 1)):
  10.     if not (data % x):
  11.         multiplied.append([x, data//x])
  12. results = []
  13. for mult in multiplied:
  14.     m1 = mult[0]
  15.     m2 = mult[1]
  16.     last_line = int(
  17.         ((m1 + m2) * 2) + (m1 - 1) * m2 + (m2 - 1) * m1
  18.     )
  19.     connect_line = int(
  20.         (m1 + 1) * (m2 + 1)
  21.     )
  22.     results.append((last_line * 2) + connect_line)
  23. result = str(min(results))
  24.  
  25. out = open('output.txt', 'w')
  26. out.write(result)
  27. out.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top