[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ํฐ์ผ๋ชฌ / Python
๐ Problem Solving/Programmers
https://programmers.co.kr/learn/courses/30/lessons/1845
import sys
from itertools import combinations
input = sys.stdin.readline
nums = list(map(int, input().split()))
def solution(nums):
n = len(nums) // 2
nums = list(set(nums))
if len(nums) > n:
return n
else:
return len(nums)
print(solution(nums))
ํด์ค
์ฒ์์ ์๋ฌด ์๊ฐ์์ด combination์ ์ด์ฉํด ํ์๋๋ฐ ์๊ฐ์ด๊ณผ๊ฐ ๊ฑธ๋ ธ๋ค..
set๋ง ์ด์ฉํด์ ๊ฐ๋จํ ํ ์ ์๋ ๋ฌธ์ ์๋๋ฐ... ํ๋ฌดํ๋ค..๐ฅ
'๐ Problem Solving > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ก๋์ ์ต๊ณ ์์์ ์ต์ ์์ / Python (0) | 2021.06.01 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์์ ๋ง๋ค๊ธฐ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ด์ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ํฌ๋ ์ธ ์ธํ๋ฝ๊ธฐ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] K๋ฒ์งธ์ / Python (0) | 2021.06.01 |