Skip to content

Commit 842af0d

Browse files
committed
[PGS]신고결과 받기/lv1/60min
1 parent 9cbfdba commit 842af0d

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Hongjoo/lv1/신고결과받기.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
def solution(id_list, report, k):
2+
answer = []
3+
# output : answer(list)
4+
#0 delete duple- suiting apply
5+
report_li =[]
6+
for n in report :
7+
if n not in report_li:
8+
report_li.append(n)
9+
#1. report : 1d -> 2d with splite both
10+
for i in range(len(report_li)):
11+
report_li[i]=report_li[i].split()
12+
#2. report : list -> dict
13+
v=[]
14+
for i in range(len(id_list)):
15+
li= []
16+
for m in range(len(report_li)):
17+
if id_list[i] == report_li[m][0]:
18+
li.append(report_li[m][1])
19+
v.append(li)
20+
dict1 =dict(zip(id_list,v))
21+
22+
#3. count suiting
23+
count_li = []
24+
for i in range(len(id_list)):
25+
count=0
26+
for values in dict1.values():
27+
for m in range(len(values)):
28+
if id_list[i] == values[m]:
29+
count+=1
30+
count_li.append(count)
31+
dict2 = dict(zip(id_list,count_li))
32+
33+
34+
# 4. suting list
35+
suiting_li = []
36+
for suiting,v in dict2.items() :
37+
if v >= k:
38+
suiting_li.append(suiting)
39+
# 5. find the num of suited_id depends on suiting_id
40+
for m,n in dict1.items():
41+
count=0
42+
for i in range(len(n)):
43+
for z in suiting_li:
44+
if z == n[i]:
45+
count +=1
46+
answer.append(count)
47+
48+
return answer

0 commit comments

Comments
 (0)