Skip to content

Commit 5cdd489

Browse files
committed
92차 2번 문제풀이
1 parent 7b9c5ea commit 5cdd489

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

live9/test92/문제2/백유진.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
def solution(board, skill):
2+
answer = len(board)*len(board[0])
3+
4+
# broken = set()
5+
6+
for s in skill:
7+
stype, r1, c1, r2, c2, degree = s
8+
for r in range(r1, r2+1):
9+
for c in range(c1, c2+1):
10+
check = False
11+
if stype == 1:
12+
if board[r][c] <= 0:
13+
check = True
14+
board[r][c] -= degree
15+
if board[r][c] <= 0:
16+
if not check:
17+
answer -= 1
18+
elif stype == 2:
19+
if board[r][c] <= 0:
20+
check = True
21+
board[r][c] += degree
22+
if board[r][c] > 0:
23+
if check:
24+
answer += 1
25+
# for i in range(len(board)):
26+
# for j in range(len(board[0])):
27+
# if board[i][j] > 0:
28+
# answer += 1
29+
# print(len(board)*len(board[0])-len(broken))
30+
return answer

0 commit comments

Comments
 (0)