https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&problemLevel=3&contestProbId=AWMedCxalW8DFAXd&categoryId=AWMedCxalW8DFAXd&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=ALL&select-1=3&pageSize=30&pageIndex=5

Untitled

Untitled

Untitled

코드

T = int(input())

def sol(order,arr):
  dic={}
  
  for i in range(1,len(arr)):
    v = arr[i]-1
    flag = False
    for key in dic.keys():
      if v%key==0: # 기존에 방문한 배가 존재
        flag = True
    if flag==False: # 처음 오는 배 
      dic[v] = True
  print('#{0} {1}'.format(order,len(dic)))
   
for i in range(1,T+1):
  n = int(input())
  arr = []
  for j in range(n):
    arr.append(int(input()))
  sol(i,arr)