์ƒˆ์†Œ์‹

๐Ÿงฎ PS

๋ฐฑ์ค€ (boj) ํŒŒ์ด์ฌ - 11050 ์ดํ•ญ ๊ณ„์ˆ˜ 1

  • -

๋ฌธ์ œ ๋งํฌ : https://www.acmicpc.net/problem/11050

 

11050๋ฒˆ: ์ดํ•ญ ๊ณ„์ˆ˜ 1

์ฒซ์งธ ์ค„์— \(N\)๊ณผ \(K\)๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. (1 ≤ \(N\) ≤ 10, 0 ≤ \(K\) ≤ \(N\))

www.acmicpc.net

 

 

์ดํ•ญ ๊ณ„์ˆ˜๊ฐ€ ๋ญ”์ง€ ๋ชฐ๋ผ์„œ ์œ„ํ‚ค๋ฐฑ๊ณผ์—์„œ ๋ณด๊ณ  ๊ทธ๋Œ€๋กœ ์ฝ”๋“œ๋กœ ์˜ฎ๊ฒผ๋‹ค.

 

* ์ดํ•ญ๊ณ„์ˆ˜

 

 

ํŒŒ์ด์ฌ ์ฝ”๋“œ
from math import factorial as f
n,k = map(int,input().split())

if k<0 or k>n : 
	print(0)
else :
	print(int(f(n)/( f(k)*f(n-k) )))โ€‹

 

 

Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.