SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import math
  2.  
  3.  
  4. def read_file():
  5.     f = open("in.txt")
  6.     nums = ""
  7.     for line in f:
  8.         if line[-1] == "\n":
  9.             line = line[:-1]
  10.         nums += line
  11.  
  12.     nums = nums.split(" ")
  13.     for i in range(len(nums)):
  14.         nums[i] = int(nums[i])
  15.  
  16.     nums.sort()
  17.  
  18.     return nums
  19.  
  20.  
  21. def find_n(binominal_coeff):
  22.     n = 3
  23.     while True:
  24.         bc = math.factorial(n)/(math.factorial(2)*math.factorial(n-2))
  25.  
  26.         if int(bc) == binominal_coeff:
  27.             return n
  28.         else:
  29.             n += 1
  30.  
  31.  
  32. def find_smaller_dist(nums, n):
  33.     m = max(nums)
  34.  
  35.  
  36. nums = read_file()
  37.  
  38. n = find_n(len(nums))
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