[백준 2422][Python] 한윤정이 이탈리아에 가서 아이스크림을 사먹는데

봉글렛·2022년 12월 27일

백준

목록 보기
8/55

문제 링크 https://www.acmicpc.net/problem/2422

람다가 써보고 싶었다... 시간이 오래 걸리지만 일단 성공. 흐음 어디서 줄일까... 나중에 다시 고민해보자

n, m = map(int, input().split())
ice_l = [[True for _ in range(n)]for _ in range(n)]
for i in range(m):
    a, b = ((lambda x: x-1)(i) for i in (map(int, input().split())))
    ice_l[a][b] = ice_l[b][a] = False

result = 0
for one in range(n):
    for two in range(one+1, n):
        for three in range(two+1, n):
            if ice_l[one][two] and ice_l[one][three] and ice_l[two][three]:
                result += 1
print(result)
profile
어쩌다 개발자 (할 수 있을 때까지!!!!)

0개의 댓글