아직 계정이 없으신가요? 회원가입

Dev. Talk

[HSAT 6차 ] 염기서열 오답 원인?

회원사진lyuhit
99 views2023-05-12 17:54


import sys

n,m = map(int, input().split())
first = input()
agcts = [list(first)]

for i in range(n-1):
    now = list(input())

    # 선발된 염기서열 하나씩 비교
    for agct in agcts:
        same = True
        # 염기서열 한 자리 씩 비교
        for j in range(m):
            if now[j] != agct[j] and now[j] != "." and agct[j] != "." :
                same = False
        if same :
            for k in range(m):
                if agct[k] == "." and now[k] != ".":
                    agct[k] = now[k]
            break
    else:
        agcts.append(now)

print(len(agcts))