diff --git a/code_study/Baekjoon/c/11050.c b/code_study/Baekjoon/c/11050.c new file mode 100644 index 0000000..77e0504 --- /dev/null +++ b/code_study/Baekjoon/c/11050.c @@ -0,0 +1,15 @@ +#include + +int main() { + int n, k, result=1, factR=1; + scanf("%d %d", &n, &k); + + for(int i=1; i<=k; i++) { + result *= n-i+1; + factR *= i; + } + + printf("%d\n",result/factR); + + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/js/11050.js b/code_study/Baekjoon/js/11050.js new file mode 100644 index 0000000..7eb3f57 --- /dev/null +++ b/code_study/Baekjoon/js/11050.js @@ -0,0 +1,2 @@ +const [n, k] = require("fs").readFileSync(0, "utf8").toString().trim().split(' ').map(Number); +console.log(Array.from({length:k}, (_,i) => n-i).reduce((acc,v) => acc*v,1) / Array.from({length:k}, (_,i) => i+1).reduce((acc,v) => acc*v,1)); \ No newline at end of file diff --git a/code_study/Baekjoon/python/11050.py b/code_study/Baekjoon/python/11050.py new file mode 100644 index 0000000..2a45110 --- /dev/null +++ b/code_study/Baekjoon/python/11050.py @@ -0,0 +1,6 @@ +n, k = map(int, input().split()) +num=denom=1 +for a,b in zip(range(n-k+1,n+1), range(1,k+1)): + num *= a + denom *= b +print(num//denom) \ No newline at end of file