-Code
from itertools import combinations
nums = sorted(list(map(int, input().split())))
n = int(input())
res = []
for com in combinations(nums, 2):
if sum(com) == n and com not in res:
res.append(com)
print(*com)
print(len(res))
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 31663번 Mean Words (0) | 2024.06.10 |
---|---|
[백준/파이썬] 8574번 Ratownik (0) | 2024.06.09 |
[백준/파이썬] 9358번 순열 접기 게임 (0) | 2024.06.07 |
[백준/파이썬] 30315번 King's Keep (1) | 2024.06.06 |
[백준/파이썬] 6139번 Speed Reading (0) | 2024.06.05 |