Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = []
- b = []
- f = open('27_A.txt')
- #f = open('tst.txt')
- n = int(f.readline())
- print(n)
- for i in range(n):
- l = [int(i) for i in f.readline().split()]
- #print(type(l))
- a.append(l[0])
- b.append(l[1])
- f.close()
- print(a)
- print(b)
- mn = 10**40
- for k in range(n):
- s = 0
- for i in range(n):
- s += abs(a[i] - a[k]) * b[i]
- mn = min(s,mn)
- print(mn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement