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的更多相关文章

  1. UVa 10007 - Count the Trees(卡特兰数+阶乘+大数)

    题目链接:UVa 10007 题意:统计n个节点的二叉树的个数 1个节点形成的二叉树的形状个数为:1 2个节点形成的二叉树的形状个数为:2 3个节点形成的二叉树的形状个数为:5 4个节点形成的二叉树的 ...

  2. Uva 10007 / HDU 1131 - Count the Trees (卡特兰数)

     Count the Trees  Another common social inability is known as ACM (Abnormally Compulsive Meditation) ...

  3. Count the Trees[HDU1131]

    Count the Trees Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  4. zjuoj 3602 Count the Trees

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3602 Count the Trees Time Limit: 2 Seco ...

  5. 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是 ...

  6. UVa 10562 Undraw the Trees 看图写树

    转载请注明: 仰望高端玩家的小清新 http://www.cnblogs.com/luruiyuan/ 题目大意: 题目传送门:UVa 10562Undraw the Trees 给定字符拼成的树,将 ...

  7. 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 ...

  8. UVa 11408 - Count DePrimes

    题目:一个数的素因子的和假设也是素数就叫做DePrimes,统计给定区间内的DePrimes. 分析:数论.本题使用用一种素数的筛法,欧拉筛法,也加线性筛法. 这样的方法,每次删选分两种情况:1.素因 ...

  9. UVA 10303 - How Many Trees?(数论 卡特兰数 高精度)

    Problem D How Many Trees? Input: standard input Output: standard output Memory Limit: 32 MB A binary ...

随机推荐

  1. mysql语法充电

    1.关键字delimiter 的作用 ①delimiter叫做“定界符”  ,经常可以在复合sql语句或者存储过程等语句中看到 DELIMITER $$ 的内容, ②DELIMITER $$的意义是告 ...

  2. 写自己的WPF样式 - 按钮

    做一个后台管理小程序,据说WPF的界面比较"炫",于是选择使用WPF来开发.既然用了WPF当然需要做好看点了,于是稍微研究了下WPF的样式,废话不多说下面开始自定义一个按钮样式: ...

  3. WebView redirect https to http

    最新项目大改版,刚好对相关sdk版本做了下升级,target也从19升级到21. 意外发现原先在WebView中加载的网页中的图片全都变得一片白,连默认图片都不给显示. 经过一番测试才发现是由于tar ...

  4. 032数值的整数次方(keep it up)

    剑指offer中题目:http://ac.jobdu.com/problem.php? pid=1514 题目描写叙述: 给定一个double类型的浮点数base和int类型的整数exponent. ...

  5. Jenkins+maven+git+sonar 系统持续集成&amp;代码单測管理

    Jenkins+maven+git+sonar 系统持续集成&代码单測管理 Jenkins的安装 Jenkins是基于Java开发的一种持续集成工具,用于监控持续反复的工作.功能包含: 1.持 ...

  6. easyui 分页实现

    1.用datagrid 做分页显示, 依据API样例,最终解决.废话不说,datagrid分页 有一个附加的分页控件 通过在datagrid中设置pagination:true 就会显示分页 当请求是 ...

  7. Ubuntu 修改时区和时间

    tzselect #根据提示选择时区 sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #把设置好的时区文件粘贴到 /etc/local ...

  8. MediaPlayer 音频播放 示例

    状态机.流程图.生命周期 对播放音频/视频文件和流的控制是通过一个状态机来管理的.下图显示一个MediaPlayer对象被支持的播放控制操作驱动的生命周期和状态. 椭圆代表MediaPlayer对象可 ...

  9. noip 2009 细胞分裂

    /*数论题 考察唯一分解定理 当然用到一些技巧*/ #include<iostream> #include<cstdio> #include<cstring> #d ...

  10. Example_07_05录音提示open failed: EACCES (Permission denied)

    在AndroidManifest.xml文件中加入下面这句话:<uses-permission android:name="android.permission.WRITE_EXTER ...