Skip to content

Commit 01608c8

Browse files
committed
Uload 1920,16165,17224
1 parent ca8aa37 commit 01608c8

File tree

4 files changed

+187
-0
lines changed

4 files changed

+187
-0
lines changed

BAEKJOON/16165/README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# 백준 16165번 \_ 걸그룹 마스터 준석이
2+
3+
## [문제 보기](https://www.acmicpc.net/problem/16165)
4+
5+
## 놓친 것
6+
7+
- 일단 성공 X(생각한 방법은 똑같으나 뭔가 막힘)
8+
- 한 줄에 숫자 두 개면 맵으로 넣기(리스트 생성 X)
9+
- Dictionary를 2개 만들어 따로 저장 후 출력
10+
- 정렬 후 출력
11+
- 1 == True
12+
13+
## 내가 짠 코드
14+
15+
```python
16+
N, M = map(int, input().split())
17+
18+
idol={}
19+
20+
for i in range(N):
21+
gname = str(input())
22+
K = int(input())
23+
names=[]
24+
for j in range(K):
25+
name = str(input())
26+
names.append(name)
27+
idol[gname]=names
28+
29+
for i in range(M):
30+
Qname = str(input())
31+
Qw = int(input())
32+
if(Qw == 1):
33+
for j in range(len(idol[Qname])):
34+
print(idol[Qname][i])
35+
else:
36+
for key, value in idol.items():
37+
if Qname in value:
38+
print(key)
39+
```
40+
41+
## 가장 적절한 코드
42+
43+
```python
44+
N, M = map(int, input().split())
45+
46+
team_mem, mem_team = {}, {}
47+
48+
for i in range(N):
49+
team_name,mem_num = input(), int(input())
50+
team_mem[team_name] = []
51+
for j in range(mem_num):
52+
name = input()
53+
team_mem[team_name].append(name)
54+
mem_team[name] = team_name
55+
56+
for i in range(M):
57+
name, q = input(), int(input())
58+
if q:
59+
print(mem_team[name])
60+
else:
61+
for mem in sorted(team_mem[name]):
62+
print(mem)
63+
```

BAEKJOON/17224/README.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# 백준 17224번 \_ APC는 왜 서브태스크 대회가 되었을까?
2+
3+
## [문제 보기](https://www.acmicpc.net/problem/17224)
4+
5+
## 놓친 것
6+
7+
- 성공( but 100점 만점은 140점)
8+
- 한 줄에 숫자 두 개면 맵으로 넣기(리스트 생성 X)
9+
- easy, hard 따로 계산 _ 더 명확하게 진행
10+
11+
## 내가 짠 코드
12+
13+
```python
14+
[N, L, K] = list(map(int, input().split()))
15+
16+
count = 0
17+
18+
solve = 0
19+
20+
for i in range(N):
21+
if(count==K):
22+
break
23+
24+
qs=list(map(int,input().split()))
25+
26+
if(qs[1]<=L):
27+
solve += 140
28+
elif(qs[0]<=L):
29+
solve += 100
30+
31+
print(solve)
32+
```
33+
34+
## 가장 적절한 코드
35+
36+
```python
37+
N, L, K = map(int, input().split())
38+
39+
easy, hard = 0, 0
40+
41+
for i in range(N):
42+
sub1, sub2 = map(int,input().split())
43+
if sub2<= L:
44+
hard += 1
45+
elif sub1 <= L:
46+
easy += 1
47+
ans = min(hard, K) *140
48+
49+
if hard < K:
50+
ans += min(K-hard, easy)*100
51+
print(ans)
52+
```

BAEKJOON/1920/README.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 백준 1920번 \_ 수찾기
2+
3+
> 정석은 이진탐색 + 찾기-> 근데 왜 오류나?
4+
5+
## [문제 보기](https://www.acmicpc.net/problem/1920)
6+
7+
## 놓친 것
8+
9+
- 일단 성공 X
10+
- Dictionary 사용
11+
- Dictionary comprehension
12+
- Dict.get(a,b) _ a = 찾을 값, b = 값이 없으면 출력
13+
14+
## 내가 짠 코드
15+
16+
```python
17+
N = int(input())
18+
A = list(map(int,input().split()))
19+
M = int(input())
20+
B = list(map(int,input().split()))
21+
22+
23+
for i in B:
24+
if i not in A:
25+
print(0)
26+
else:
27+
print(1)
28+
29+
```
30+
31+
```python
32+
def bns(lst, search):
33+
if(len(lst)==1 and search == lst[0]):
34+
return 1
35+
if(len(lst)==1 and search != lst[0]):
36+
return 0
37+
if len(lst)==0:
38+
return 0
39+
40+
med = len(lst)//2
41+
if(search == lst[med]):
42+
return 1
43+
else:
44+
if(search > lst[med]):
45+
return bns(lst[med+1:],search)
46+
else:
47+
return bns(lst[:med],search)
48+
49+
N = int(input())
50+
A = list(map(int,input().split()))
51+
M = int(input())
52+
B = list(map(int,input().split()))
53+
54+
A.sort()
55+
56+
for i in range(M):
57+
print(bns(A,B[i]))
58+
```
59+
60+
## 가장 적절한 코드
61+
62+
```python
63+
N, A = int(input()), {i: 1 for i in map(int, input().split())}
64+
65+
M = input()
66+
67+
for i in list(map(int, input().split())):
68+
print(A.get(i,0))
69+
```

BAEKJOON/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# 백준을 풀어보자
22

3+
- [1920번 수찾기](1920)
34
- [10539번 수빈이와 수열](10539)
45
- [15969번 행복](15969)
6+
- [16165번 걸그룹 마스터 준석이](16165)
7+
- [17224번 APC는 왜 서브태스크 대회가 되었을까?](17224)
58
- [17269번 이름궁합 테스트](17269)
69
- [17389번 보너스 점수](17389)

0 commit comments

Comments
 (0)