daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Feb 17th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2. a = [[10 ** 25]*  2 for i in range(35)]
  3. for i in range(n):
  4.     x = int(input())
  5.     y = x % 35
  6.     if a[y][0] > x:
  7.         a[y][1] = a[y][0]
  8.         a[y][0] = x
  9.     elif a[y][1] > x:
  10.         a[y][1] = x
  11. ans1 = 10**25
  12. ans2 = 10**25
  13. for i in range(35):
  14.     for j in range(35):
  15.         if (i * j) % 35 == 0:
  16.             if (i == j):
  17.                 ans1 = min(ans1, a[i][0] * a[i][1])
  18.             else:
  19.                 ans1 = min(ans1, a[i][0] * a[j][0])
  20.         else:
  21.             if (i == j):
  22.                 ans2 = min(ans2, a[i][0] * a[i][1])
  23.             else:
  24.                 ans2 = min(ans2, a[i][0] * a[j][0])
  25. print(ans1, ans2)
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