MCPcopy Create free account
hub / github.com/E869120/math-algorithm-book / main

Method main

editorial/chap3-3/prob3-3-3.java:4–19  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

2
3class Main {
4 public static void main(String[] args) {
5 Scanner sc = new Scanner(System.in);
6
7 // 入力
8 int n = sc.nextInt();
9 int r = sc.nextInt();
10
11 // 会場の計算
12 long fact_n = 1, fact_r = 1, fact_nr = 1;
13 for (int i = 1; i <= n; i++) fact_n *= i;
14 for (int i = 1; i <= r; i++) fact_r *= i;
15 for (int i = 1; i <= n - r; i++) fact_nr *= i;
16
17 // 出力
18 System.out.println(fact_n / (fact_r * fact_nr));
19 }
20}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected