uva 10007 Count the Trees
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=948
卡特兰数*n!
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[]args)
{
Scanner cin=new Scanner(System.in);
BigInteger []a=new BigInteger[1000];
a[0]=BigInteger.valueOf(1);
for(int i=1; i<=300; i++)
{
int m=(4*i-2);
a[i]=a[i-1].multiply(BigInteger.valueOf(m));
a[i]=a[i].divide(BigInteger.valueOf(i+1));
}
int n;
while(cin.hasNext())
{
n=cin.nextInt();
if(n==0) break;
BigInteger ans=BigInteger.valueOf(1);
for(int i=1; i<=n; i++)
{
ans=ans.multiply(BigInteger.valueOf(i));
}
ans=ans.multiply(a[n]);
System.out.println(ans);
}
}
}
uva 10007 Count the Trees的更多相关文章
- UVa 10007 - Count the Trees(卡特兰数+阶乘+大数)
题目链接:UVa 10007 题意:统计n个节点的二叉树的个数 1个节点形成的二叉树的形状个数为:1 2个节点形成的二叉树的形状个数为:2 3个节点形成的二叉树的形状个数为:5 4个节点形成的二叉树的 ...
- Uva 10007 / HDU 1131 - Count the Trees (卡特兰数)
Count the Trees Another common social inability is known as ACM (Abnormally Compulsive Meditation) ...
- Count the Trees[HDU1131]
Count the Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- zjuoj 3602 Count the Trees
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3602 Count the Trees Time Limit: 2 Seco ...
- uva 10712 - Count the Numbers(数位dp)
题目链接:uva 10712 - Count the Numbers 题目大意:给出n,a.b.问说在a到b之间有多少个n. 解题思路:数位dp.dp[i][j][x][y]表示第i位为j的时候.x是 ...
- UVa 10562 Undraw the Trees 看图写树
转载请注明: 仰望高端玩家的小清新 http://www.cnblogs.com/luruiyuan/ 题目大意: 题目传送门:UVa 10562Undraw the Trees 给定字符拼成的树,将 ...
- TZOJ 4292 Count the Trees(树hash)
描述 A binary tree is a tree data structure in which each node has at most two child nodes, usually di ...
- UVa 11408 - Count DePrimes
题目:一个数的素因子的和假设也是素数就叫做DePrimes,统计给定区间内的DePrimes. 分析:数论.本题使用用一种素数的筛法,欧拉筛法,也加线性筛法. 这样的方法,每次删选分两种情况:1.素因 ...
- UVA 10303 - How Many Trees?(数论 卡特兰数 高精度)
Problem D How Many Trees? Input: standard input Output: standard output Memory Limit: 32 MB A binary ...
随机推荐
- [置顶] VB 中chr(10)、chr(13)和vblf、vbcr、vbcrlf的分别
1.共同点: chr(10):换行,相当于VBLF chr(13):回车,相当于VBCR chr(13)+chr(10):回车+换行,相当于VBCRLF cr是回车,只有回车,是到本行的最头上:lf是 ...
- windows快捷键和命令
以管理员方式打开命令行界面:win+X+A 打开服务界面:services.msc 删掉windows系统记住的WIFI密码 cmd下面运行 显示存储的无线连接netsh wlan show prof ...
- php显示日期(今天、昨天、本周、上周、本月、上月、)
<?php //今天 $today = date("Y-m-d"); //昨天 $yesterday = date("Y-m-d", strtotime( ...
- HDU4512:吉哥系列故事——完美队形I(LICS)
Problem Description 吉哥这几天对队形比较感兴趣. 有一天,有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ... h[n],吉哥希望从中挑出一些人,让这些人形成一 ...
- ajax_get方式
test_ajax_get.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " ...
- 一位学长的ACM总结(感触颇深)
发信人: fennec (fennec), 信区: Algorithm 标 题: acm 总结 by fennec 发信站: 吉林大学牡丹园站 (Wed Dec 8 16:27:55 2004) AC ...
- 粘帖屏幕截图到web页面插件 screenshot-paste
在很多场合下,我们可能有这样的需求:提供个屏幕截图上传到系统,作为一个凭证.传统的操作方式是:屏幕截图,保存文件到本地,在web页面上选择本地文件并上传,这里至少需要三步.有没有可能直接将截图粘帖到w ...
- Visual Studio2015 Community一些必备插件
Visual Studio2015 Community一些必备插件 是不是感觉虽然VS2015的代码编辑能力已经很强大了,但是总感觉差了那么一些呢?不用担心,它有很多非常强大的插件,能够让你打代码事半 ...
- java反射新的应用
利用java反射动态修改运行中对象的私有final变量,不管有没有get方法获取这个私有final变量. spring aop 本质是cglib,动态代理 可以做很多事情 query.addCrite ...
- <customErrors>节点说明1
<customErrors>节点用于定义一些自定义错误信息的信息.此节点有Mode和defaultRedirect两个属性, 其中defaultRedirect属性是一个可选属性,表示应用 ...