-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgui.py
46 lines (40 loc) · 980 Bytes
/
gui.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
# import tkinter as tk
# win = tk.Tk()
# win.title("Python gui")
# win.mainloop()
#
# class TestBed:
# def __init__(self):
# return self
#
# def attack1(self):
# # attack the system
#
# def attack2(self):
# # attack the system
#
#
class Solution:
def numPairsDivisibleBy60(self, time):
n = 0
ls = []
for i in range(len(time)):
# [30,20,150,100,40,50,10]
# [10,20,30,40,50,100,150]
#
ls.append(time[i] % 60)
d = {}
for i in range(len(time)):
if d.get(time[i], False):
d[time[i]] += 1
else:
d[time[i]] = 1
for i in range(len(time)):
c = d[time[i]]
if time[i] == 0 or time[i] == 30:
n += (c * (c-1)) / 2
else:
n += c * d[time[60-i]]
return n
k = Solution()
print (k.numPairsDivisibleBy60([30,20,150,100,40]))