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 ...
随机推荐
- FPGA技术的一些基本概念(综合、BlackBox)(转)
原文:http://blog.sina.com.cn/s/blog_6254a8ca0100i0wr.html 原文也是转的,哈哈,大家多转转,转转更健康.删除了一些Xilinx的东西 前言 综合是将 ...
- 暴力破解UltraEdit v21 无需注册
一.复制一份UltraEdit安装目录中的主程序uedit32.exe,到任意目录,用UltraEdit打开复制的uedit32.exe文件. 二.修改以下内容 原来:00094750h: BE DC ...
- keil c51 本變數型態(Variable Type)
本變數型態(Variable Type): 類 別 符號位元 位元組(bytes) 表 示 法 數 值 範 圍 整 數 有 2 int(short) -32768~0~>32767 4 long ...
- HDU 1540 Tunnel Warfare (线段树)
题目大意: n 个村庄排列在一条直线上,相邻的村庄有地道连接,除首尾两个村庄外,其余村庄都有两个相邻的村庄.其中有 3 中操作 D x :表示摧毁编号为 x 的村庄,Q x:表示求出包含村庄 x 的最 ...
- Linux用户管理(笔记)
用户:UID, /etc/passwd组:GID, /etc/group 影子口令:用户:/etc/shadow组:/etc/gshadow 用户类别:管理员:0普通用户: 1-65535 系统 ...
- Linux NFS服务器搭建
1.NFS:NFS(Network File System)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源. 在NFS的应用中,本地N ...
- Android系统进程间通信(IPC)机制Binder中的Server启动过程源代码分析
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/6629298 在前面一篇文章浅谈Android系 ...
- qt超强精美绘图控件 - QCustomPlot一览 及 安装使用教程
1.概述 QCustomPlot 是一个超强超小巧的qt绘图类,非常漂亮,非常易用,只需要加入一个qcustomplot.h和qcustomplot.cpp文件即可使用,远比qwt方便和漂亮,可以自己 ...
- Git服务器 gitweb与gitLab的区别
昨天我们已经把Git服务器搭建完成了,工程的上传与下载都可以了,不过有些人不喜欢使用git命令进行操作.所以我们就搭建一个可视化操作的环境!配置gitweb和gitlab两种访问方式! 一,配置git ...
- MySql命令——函数
1.拼接字段——Concata() 把多个串连接起来形成一个较长的串. select concat(value,'(',id,')') from test; 2.去掉空格 RTrim() 去掉右边的空 ...