๐Ÿ—๏ธ Algorithm/๐ŸŸฉ ๋ฐฑ์ค€

๐ŸŸฉ [๋ฐฑ์ค€] [Python] Class3_2407๋ฒˆ_ ์กฐํ•ฉ

Dbswnstjd 2022. 10. 31. 02:16

๋ฌธ์ œ

https://www.acmicpc.net/problem/2407

 

2407๋ฒˆ: ์กฐํ•ฉ

n๊ณผ m์ด ์ฃผ์–ด์ง„๋‹ค. (5 ≤ n ≤ 100, 5 ≤ m ≤ 100, m ≤ n)

www.acmicpc.net

ํ’€์ด

# ๋ฐฑ์ค€ 2407๋ฒˆ ๋ฌธ์ œ - ์กฐํ•ฉ
import math
n, m = map(int, input().split())

print(int(math.factorial(n) // (math.factorial(m)*math.factorial(n-m))))

factorial ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋งค์šฐ ์‰ฝ๊ฒŒ ํ’€ ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ์˜€๋‹ค.