[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] ์์ฅ / Python
๐ Problem Solving/Programmers
import sys
input = sys.stdin.readline
clothes = [list((map(str, input().split()))) for _ in range(int(input()))]
def solution(clothes):
temp = {}
for i in clothes:
if i[1] in temp:
temp[i[1]] += 1
else:
temp[i[1]] = 1
answer = 1
for i in temp.values():
answer *= i + 1
return answer - 1
print(solution(clothes))
ํด์ค
๋์ ๋๋ฆฌ๋ฅผ ์ด์ฉํด ์ท ์ข ๋ฅ์ ๊ฐ์๋ฅผ ์ ์ฅํ๋ค. ๊ตฌํ ๊ฐ์ผ๋ก ์ ์ ์ ์๋ ์ท์ ์กฐํฉ ์๋ฅผ ๊ตฌํ๋ ๊ณต์์ (๊ฐ ์ข ๋ฅ +1)์ ์๋ก ๊ณฑํด์ฃผ๊ณ ๊ฒฐ๊ณผ์ ํ๋๋ฅผ ๋นผ์ค ๊ฐ์ด๋ค.
'๐ Problem Solving > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] H-index / Python (0) | 2021.06.14 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] ๋ค๋ฆฌ๋ฅผ ์ง๋๋ ํธ๋ญ / Python (0) | 2021.06.14 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] ์นดํซ / Python (0) | 2021.06.14 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] ๊ฐ์ฅ ํฐ ์ / Python (0) | 2021.06.14 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv2] ์์์ฐพ๊ธฐ / Python (0) | 2021.06.03 |