UVa 369 - Combinations
2024-08-25 14:55:11
题目大意:给两个数n, m,求C(n, m)。用java直接写就好了。
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[n].divide(fact[m]).divide(fact[n-m]);
System.out.println(n + " things taken " + m + " at a time is " + ans + " exactly.");
} }
}
最新文章
- ccpc_南阳 C The Battle of chibi dp + 树状数组
- 用spring的InitializingBean作初始化
- Neuroaesthetics神经美学
- Linux SO_KEEPALIVE属性,心跳
- make xxx Is a directory. Stop.
- Solr开发参考文档(转)
- nuc900 nand flash mtd 驱动
- PHPMailer发送邮件方法
- 关于appcompat_v7兼容包的详细说明
- 读Zepto源码之Ajax模块
- JPG .vs. PNG
- MyDAL - is null &;&; is not null 条件 使用
- use case 的缺陷
- IPTABLES使用总结(内网模拟银行网络)
- Visual Studio 2015 key 许可证,下载地址
- ssh Jetson tk1
- Mysql 64位解压版的安装
- rlwrap与历史命令
- Omnigraffle快捷键
- centos 搭建docker环境