-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
58 lines (42 loc) · 1.21 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# # class Solution:
# # def solve(self , n , m , a ):
# # l, r = 1, min(a)
# # while l < r:
# # mid = l + (r-l) // 2
# # cnt = self.helper(a, mid)
# # if cnt >= m:
# # l = mid + 1
# # else:
# # r = mid
# # # return res
# # cnt = self.helper(a, l)
# # if cnt < m:
# # return l - 1
# # else:
# # return l
# # def helper(self, a, min_count):
# # array = a
# # cnt = 0
# # for a in array:
# # cnt += a // min_count
# # return cnt
# # Solution().solve(3,5,[3,5,6])
# class Solution:
# def function(self, arrays, n, d):
# if n == 0:
# return 0
# arrays = sorted(arrays)
# cur = arrays[0]
# count = 1
# for n in arrays:
# if n - cur >= d:
# cur = n
# count += 1
# return count
# print(Solution().function([1,4,2,8,5,7],6,2))
import numpy as np
a = np.array([83,94,77,79,80,90,90,96,95,87,92,96,83,85])
b = np.array([1,1,3,2,2,1,1,1,3,3,2,2,3,2])
assert len(a) == len(b)
c = np.sum(a * b)
print(c/sum(b))