-
Notifications
You must be signed in to change notification settings - Fork 17
/
logic.py
47 lines (44 loc) · 1.05 KB
/
logic.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
n=int(input())
for i in range(0,n):
wlen=int(input())
s=input()
t=float(input())
words=s.split()
time=0.0
wordss=set(words)
wordss=list(wordss)
left=['q','w','e','r','t']
right=['y','u','i','o','p']
tl=0.2
tr=0.1
a=[0 for word in wordss]
b=[0.0 for word in wordss]
for word in words:
letters = list(word)
L=0
R=0
tim=0
index=wordss.index(word)
if a[index] == 0:
for let in letters:
if let in left:
tim=tim+tl*(2**L)
L+=1
R=0
elif let in right:
tim=tim+tr*(2**R)
R+=1
L=0
a[index]+=1
b[index]=tim
else:
tim=b[index]/2
time=time+tim+0.3
time-=0.3
time=round(time,1)
if time<t:
print("WORK HARDER, {}".format(time))
elif time==t:
print("GOOD, {}".format(time))
else:
print("GREAT JOB, {}".format(time))