본문 바로가기

카테고리 없음

코딜리티 lesson11 에라토스테네스의 체(소수구하기) CountNonDivisible(?), CountSemiprimes

x

[최초코드]

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A):
    ans = []
    for i in range(len(A)):
        cnt = 0
        for j in range(len(A)):
            if i != j:
                if A[i] % A[j] != 0:
                    cnt += 1
                
        ans.append(cnt)

    return ans