hdu Buy the Ticket
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String []args)
{
Scanner cin=new Scanner(System.in);
int n,m,i;
int t1=0;
while(cin.hasNextBigInteger())
{
t1++;
m=cin.nextInt();
n=cin.nextInt();
if(m==0&&n==0) break;
System.out.println("Test #"+t1+":");
if(n>m)
{
System.out.println("0");
}
else
{
BigInteger sum=new BigInteger("1");
for(i=m+n; i>=1; i--)
{
BigInteger c1=new BigInteger(((Integer)i).toString());
sum=sum.multiply(c1);
}
int c=(m-n+1);
BigInteger m2=new BigInteger(((Integer)(m+1)).toString());
BigInteger m1=new BigInteger(((Integer)c).toString());
System.out.println(sum.multiply(m1).divide(m2));
}
}
} }
hdu Buy the Ticket的更多相关文章
- 【HDU 1133】 Buy the Ticket (卡特兰数)
Buy the Ticket Problem Description The "Harry Potter and the Goblet of Fire" will be on sh ...
- hdu 1133 Buy the Ticket(Catalan)
Buy the Ticket Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...
- hdu 1133 Buy the Ticket (大数+递推)
Buy the Ticket Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- HDU——1133 Buy the Ticket
Buy the Ticket Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...
- HDU 1133 Buy the Ticket (数学、大数阶乘)
Buy the Ticket Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- HDUOJ---1133(卡特兰数扩展)Buy the Ticket
Buy the Ticket Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- Buy the Ticket{HDU1133}
Buy the TicketTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- 【高精度练习+卡特兰数】【Uva1133】Buy the Ticket
Buy the Ticket Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...
- Buy the Ticket(卡特兰数+递推高精度)
Buy the Ticket Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
随机推荐
- JS 浮点计算BUG
最近做项目的时候遇到一个比较纠结的js浮点计算问题. 当时是做利率计算,因为利率大多数涉及到小数点,精度要求也很高. 0.6+0.1+0.1=? 结果出现:0.7999999999999 网上查找了一 ...
- 单路CPU性能排名 更新于2015.10.6
http://itianti.sinaapp.com/index.php/cpu 排名 处理器 图例 分数 1 Intel Xeon E5-2699 v3 @ 2.30GHz 22892 2 Inte ...
- JavaScript实现网页右下角弹出窗口代码
<script language="JavaScript"><!--var no = 50;var speed = 1;var ns4up = (document ...
- /proc/uptime
在Linux中,我们常常会使用到uptime命令去看看系统的运行时间,它与一个文件有关,就是/proc/uptime.这个文件里的两个参数所代表的意义如下. [root@app ~]#cat /pro ...
- ActionResult解析
原文地址:http://blog.csdn.net/gulijiang2008/article/details/7642213 ActionResult是一个抽象类, 在Action中返回的都是其派生 ...
- 特殊权限:SUID,SGID,Sticky
特殊权限passwd:s SUID: 运行某程序时,相应进程的属主是程序文件自身的属主,而不是启动者: chmod u+s FILE chmod u-s FILE 如果FIL ...
- JAVA中的Formatter
package com.st.day20150525; import java.util.Formatter; public class StringTest02 { /** * %[argument ...
- 【转】Linux下socket keep alive讲解
[需求]不影响服务器处理的前提下,检测客户端程序是否被强制终了.[现状]服务器端和客户端的Socket都设定了keepalive属性.服务器端设定了探测次数等参数,客户端.服务器只是打开了keepal ...
- VirtualBox 扩展包卸载或安装失败(VERR_ALREADY_EXISTS)
最近在卸载VirtualBox出现了无法卸载的错误.提示为Failed to install the extension. The installer failed with exit code 1: ...
- ZOJ Goldbach 2013年长沙赛区网络赛
迟到了一天的AC.... 思路: 先把单个素数 或着 两个素数能组成的情况预处理一下,然后对于给出的 n,拿第三个素数去和两个素数的情况匹配,最后要注意去重. 详情见代码. 因为手残少敲了一个 els ...