题目大意:给两个数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.");
} }
}

UVa 369 - Combinations的更多相关文章

  1. 10_放置街灯(Placing Lampposts,UVa 10859)

    问题来源:刘汝佳<算法竞赛入门经典--训练指南> P70 例题30: 问题描述:有给你一个n个点m条边(m<n<=1000)的无向无环图,在尽量少的节点上放灯,使得所有边都被照 ...

  2. UVa 10012 - How Big Is It? 堆球问题 全排列+坐标模拟 数据

    题意:给出几个圆的半径,贴着底下排放在一个长方形里面,求出如何摆放能使长方形底下长度最短. 由于球的个数不会超过8, 所以用全排列一个一个计算底下的长度,然后记录最短就行了. 全排列用next_per ...

  3. POJ 1087 A Plug for UNIX / HDU 1526 A Plug for UNIX / ZOJ 1157 A Plug for UNIX / UVA 753 A Plug for UNIX / UVAlive 5418 A Plug for UNIX / SCU 1671 A Plug for UNIX (网络流)

    POJ 1087 A Plug for UNIX / HDU 1526 A Plug for UNIX / ZOJ 1157 A Plug for UNIX / UVA 753 A Plug for ...

  4. poj1285 Combinations, Once Again(泛化背包)

    题目传送门 Combinations, Once Again Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1897   A ...

  5. Fast Matrix Operations(UVA)11992

    UVA 11992 - Fast Matrix Operations 给定一个r*c(r<=20,r*c<=1e6)的矩阵,其元素都是0,现在对其子矩阵进行操作. 1 x1 y1 x2 y ...

  6. Combinations

    Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For exampl ...

  7. [LeetCode] Factor Combinations 因子组合

    Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a func ...

  8. [LeetCode] Combinations 组合项

    Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For exampl ...

  9. [LeetCode] Letter Combinations of a Phone Number 电话号码的字母组合

    Given a digit string, return all possible letter combinations that the number could represent. A map ...

随机推荐

  1. as3 组件定义

    package kingBook{ import flash.display.MovieClip; import flash.events.Event; import flash.utils.setT ...

  2. angularjs model.service vs provider vs factory?

    <!DOCTYPE html> <html ng-app="app"> <head> <script src="http://c ...

  3. Python文件打包成EXE文件

    工具:pyinstaller 安装:pip install pyinstaller 使用: 1 将依赖文件集中到一个文件夹:           pyinstaller -D -w xxx.py    ...

  4. Linux中的挂载和卸载

    mkdir /home/xxx   创建挂载点 mount /dev/cdrom /home/xxx   把cdrom中的内容挂载到xxx目录 umount /dev/cdrom 卸载 /dev/sr ...

  5. 转:webdriver驱动未在默认目录安装的firefox

    刚开始用webdriver的朋友一定会苦恼它时常不能启动firefox,很多时候是因为firefox安装在默认路径下.此时,我们有些常用方法,可以解决此问题. [1] System.setProper ...

  6. xdebug 安装

    如果是这样的话,请参考 http://www.mengyunzhi.com/share/php/107-xdebug.html 进行xdebug的安装.

  7. Codeforces Round #349 (Div. 2) C. Reberland Linguistics (DP)

    C. Reberland Linguistics time limit per test 1 second memory limit per test 256 megabytes input stan ...

  8. JSP标准标签库(JSTL)--国际化标签库 fmt

    JSTL中使用fmt.tld作为格式化标签库的定义文件 No. 功能分类 标签名称 描述 1 国际化标签 <fmt:setLocale> 设置一个全局的地区代码 2 <fmt:req ...

  9. DLL、lib等链接库文件的使用

    由于遇见过多次动态链接库的使用,自己也写过DLL,每次都要费好大劲去配置,现在就简单的总结一下,争取以后少走弯路! 一般都会有三个文件: .h  头文件 .lib  静态链接库 .dll  动态链接库 ...

  10. oracle 日期相减

    oracle日期相减2012-02-10 12:18--MONTHS_BETWEEN(date2,date1) 给出date2-date1的月份 SQL> select months_betwe ...