top of page

소스 코드 제출

공개·회원 77명

손유준손유준

20250813

# K = int(input())

# n = input()

# a = [n[i] for i in range(K - 1, -1, -1)]

# n = ''.join(a)

# stack = []

# top = 0

# c = 0

#

# def push(x):

# global top

# stack.append(x)

# top += 1

# def pop():

# global top

# top -= 1

#

# for i in range(K-1):

# push(n[i])

# if (top) % 3 == 0:

# push(',')

# pop()

# stack.append(n[K-1])

# print(''.join(reversed(stack)))



# 4 4 4 4 1 4 3

# 4 4 4 4 3 2 4

# 4 4 4 4 5 5 4

# 4 4 4 4 2 1 3

# 5 5 3 2 4 4 4

# 2 1 1 3 4 4 4

# 5 4 5 5 4 4 4


# 1 2 4 1 2 3 5

# 2 4 4 4 1 2 3

# 5 4 2 3 2 2 4

# 2 2 1 5 3 4 1

# 3 3 4 2 4 1 4

# 1 3 2 2 1 5 2

# 3 2 5 2 2 3 4

import sys

sys.setrecursionlimit(150000)

a = 0

n = 0

ground = []


for _ in range(7):

ground.append([0] + list(map(int, input().split())) + [0])

ground.append([0]*9)

ground.insert(0, [0]*9)



def check(y, x, k):

global a

if ground[y][x] != 0:

if ground[y][x] == k:

a += 1

ground[y][x] = 0

for ni in range(-1, 2):

for nj in range(-1, 2):

if ni == 0 or nj == 0:

check(y+ni, x+nj, k)


for i in range(1, 8):

for j in range(1, 8):

check(i, j, ground[i][j])

if a >= 3:

n += 1

a = 0


print(n)

2회 조회
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546 ,     031) 215 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호
bottom of page