UVa 369 - Combinations
2013-10-01 18:39
302 查看
题目大意:给两个数n, m,求C(n, m)。用java直接写就好了。
View Code
import java.io.*; import java.util.*; import java.math.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); BigInteger[] fact = new BigInteger[110]; fact[0] = BigInteger.ONE; for (int i = 1; i <= 100; i++) fact[i] = fact[i-1].multiply(BigInteger.valueOf(i)); int n, m; while (sc.hasNext()) { n = sc.nextInt(); m = sc.nextInt(); if (n == 0 && m == 0) break; BigInteger ans = fact .divide(fact[m]).divide(fact[n-m]); System.out.println(n + " things taken " + m + " at a time is " + ans + " exactly."); } } }
View Code
相关文章推荐
- POJ1306 UVA369 UVALive5341 Combinations【组合计算】
- UVa 369 Combinations (用double算组合数)
- UVa 369 - Combinations
- UVa:369 Combinations
- UVA 369题Combinations(一个排列组合问题)
- UVa369 - Combinations
- 369 - Combinations
- UVA, 369 conbinations
- UVa 757 - Gone Fishing
- uva 147 Dollars(完全背包)
- UVa123 - Searching Quickly
- UVA 11019 Matrix Matcher(AC自动机:矩阵匹配)
- UVA 11292-Dragon of Loowater (思维)
- UVA - 10673 - Play with Floor and Ceil (简单数学!)
- uva 10564 沙漏
- UVA1347-Tour 双调欧几里得旅行商问题 - 递归记忆实现
- UVA 716(Commedia dell' arte-三维八数码)
- uva1412 基金管理
- UVA 753 A Plug for UNIX(最大流)
- ( UVALive 7720)J - Super Sum(逆元+扩展欧几里得/费马小定理)(补)