[백준] #20125 쿠키의 신체 측정 python
2023. 9. 26. 12:57
https://www.acmicpc.net/problem/20125
📕 나의 풀이 📕
'''
Method : Typing Studying
title : cookie
condition :
matrix
head, heart, left_arm, right_arm, waist, left_leg, right_leg
solutions :
i can solve this prob. from heart and waist
'''
🧑🏻💻 나의 코드 🧑🏻💻
N = int(input())
cookie_body = [input() for _ in range(N)]
heart = []
left_arm, right_arm, waist, left_leg, right_leg = 0, 0, 0, 0, 0
for i in range(N):
for j in range(N):
if cookie_body[i][j] == "*":
heart = [i + 2, j + 1]
break
if len(heart) > 0:
break
print(*heart)
for i in range(heart[1] - 1):
if cookie_body[heart[0] - 1][i] == '*':
left_arm += 1
for i in range(heart[1], N):
if cookie_body[heart[0] - 1][i] == '*':
right_arm += 1
length = 0
for i in range(heart[0], N):
if cookie_body[i][heart[1] - 1] == '*':
waist += 1
length = i
for i in range(N - 1, length, -1):
if cookie_body[i][heart[1] - 2] == "*":
left_leg += 1
for i in range(N - 1, length, -1):
if cookie_body[i][heart[1]] == "*":
right_leg += 1
print(left_arm, right_arm, waist, left_leg, right_leg)
'Programming > Algorithm' 카테고리의 다른 글
[백준] #1009 분산처리 python (2) | 2023.12.21 |
---|---|
[백준] #1205 등수 구하기 python (0) | 2023.09.27 |
[백준] #25757 임스와 함께하는 미니게임 python (0) | 2023.09.25 |
[백준] #4659 비밀번호 발음하기 python (0) | 2023.09.24 |
[백준] #10878 스택 python (0) | 2023.09.23 |