-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path쿠키의 신체 측정.py
More file actions
57 lines (47 loc) · 1.44 KB
/
쿠키의 신체 측정.py
File metadata and controls
57 lines (47 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
n = int(input())
arr = []
heart_x, heart_y = 0, 0
for i in range(n):
arr.append(list(input()))
for i in range(n):
for j in range(n):
if arr[i][j] == '*' and arr[i - 1][j] == '*' and arr[i][j - 1] == '*' and arr[i][j + 1] == '*' and arr[i + 1][j] == '*' and i > 0 and i < n - 1 and j > 0 and j < n - 1:
heart_x = i
heart_y = j
x, y = heart_x, heart_y - 1
cnt_left_arm = 0
while arr[x][y] == '*':
cnt_left_arm += 1
y -= 1
if 0 > x or n <= x or 0 > y or y >= n:
break
x, y = heart_x, heart_y + 1
cnt_right_arm = 0
while arr[x][y] == '*':
cnt_right_arm += 1
y += 1
if 0 > x or n <= x or 0 > y or y >= n:
break
x, y = heart_x + 1, heart_y
cnt_weist = 0
while arr[x][y] == '*':
cnt_weist += 1
x += 1
if 0 > x or n <= x or 0 > y or y >= n:
break
left_leg_x, left_leg_y = x, y - 1
cnt_left_leg = 0
while arr[left_leg_x][left_leg_y] == '*':
cnt_left_leg += 1
left_leg_x += 1
if 0 > left_leg_x or n <= left_leg_x or 0 > left_leg_y or left_leg_y >= n:
break
right_leg_x, right_leg_y = x, y + 1
cnt_right_leg = 0
while arr[right_leg_x][right_leg_y] =='*':
cnt_right_leg += 1
right_leg_x += 1
if 0 > right_leg_x or n <= right_leg_x or 0 > right_leg_y or right_leg_y >= n:
break
print(heart_x + 1, heart_y + 1)
print(cnt_left_arm, cnt_right_arm, cnt_weist, cnt_left_leg, cnt_right_leg)