top of page

소스 코드 제출

공개·회원 52명

20250712


'''
def isin(no) :      # 리스트a에 no를 가진 데이터가 있는지 없는지 확인하는 함수
    global a
    for i in range(len(a)) :
        if a[i][0]==no :
            return i
    return -1
n=int(input())
a=[]
d=[]
q=[]
# int : 정수
# float : 실수
# str : 문자열
# bool : True or False
for i in range(n):
    c,no,x=input().split()
    num = isin(int(no)) # num : no를 가진 데이터가 있다면 그 위치, 없다면 -1
    if c=='I' and num==-1 :         # 삽입해라 그리고 중복데이터가 없다
        a.append([int(no), x])
    elif c=='D' and num!=-1 :       # 삭제해라 그리고 중복데이터가 있다
        a.pop(num)                  # 그 위치의 데이터 삭제
a.sort(key=lambda x: x[0])

b=list(map(int, input().split()))
for j in range(len(a)):
     print(a[b[j]-1][0],a[b[j]-1][1])

'''

# def move(color,rst) :
#     color 자동차를타고 rst에 가기
#
# move(빨간색,집)
# move(노란색,학원)

# def mysum(arr) :
#     s=0
#     for x in range(len(arr)) :
#         s+=arr[x]
#     return s,'hello'
#
# arr = [3,1,2,4,7,8,1,2]
#
# # print(sum(arr))
# print(mysum(arr))

def myfind(x,y):
    global a
    b=[]
    for j in range(3):
        for k in range(3):
            if 9>=x-2+j>=0 and 9>=y-2+k>=0 :
                b.append(int(a[x-2+j][y-2+k]))
    return b
a=[]
for i in range(9):
    a.append(input().split())
r,c=map(int, input().split())
if a[r-1][c-1]=='1' :
    print('-1')
else :
    d=myfind(r,c)
    sum=0
    for f in range(len(d)):
        sum=sum+d[f]
    print(sum)

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