Skip to content

Commit e3eb46d

Browse files
Merge pull request #550 from gmlrude/main
[박희경] 69차 라이브 코테 제출
2 parents e79895c + 5b0d423 commit e3eb46d

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

live6/test69/문제1/박희경.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n, m = map(int, input().split())
6+
chess = [list(map(str, input().rstrip())) for _ in range(n)]
7+
8+
cnt = []
9+
for a in range(n - 7):
10+
for b in range(m - 7):
11+
white = 0
12+
black = 0
13+
for i in range(a, a + 8):
14+
for j in range(b, b + 8):
15+
# (0, 0), (0, 2), (2, 0) 이 같은 색이어야 함
16+
if (i + j) % 2 == 0:
17+
if chess[i][j] != 'W':
18+
white += 1
19+
else:
20+
black += 1
21+
else:
22+
if chess[i][j] != 'W':
23+
black += 1
24+
else:
25+
white += 1
26+
cnt.append(white)
27+
cnt.append(black)
28+
print(min(cnt))

live6/test69/문제2/박희경.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import sys
2+
from itertools import *
3+
4+
input = sys.stdin.readline
5+
6+
n = int(input())
7+
arr = [i for i in range(1, n + 1)]
8+
9+
for perm in permutations(arr, n):
10+
print(*perm)

live6/test69/문제3/박희경.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import copy
2+
3+
4+
def solution(want, number, discount):
5+
answer = 0
6+
7+
product = {}
8+
for i in range(len(want)):
9+
product[want[i]] = number[i]
10+
11+
for a in range(len(discount) - 9):
12+
tmp_product = copy.deepcopy(product)
13+
for i in range(a, a + 10):
14+
if discount[i] in want:
15+
tmp_product[discount[i]] -= 1
16+
17+
# 모두 0일 때 카운팅
18+
if all(value <= 0 for value in tmp_product.values()):
19+
answer += 1
20+
21+
return answer

0 commit comments

Comments
 (0)