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. 微信小程序简易教程

    刚接触到微信小程序开发,这里做一个简单的教程: 1. 获取微信小程序的 AppID 登录 https://mp.weixin.qq.com ,就可以在网站的"设置"-"开 ...

  2. 使用MJRefresh遇到的坑

    在使用MJRefresh的时候,下拉刷新表头停在了上部,箭头并没有隐藏 解决方法:进行数据请求的时候不要使用 beginRefresh方法,要直接调用方法进行数据请求

  3. 数据迁移sql

    1.把数据库test中的表Table1中的数据插入到数据库test2中的表Table2:insert into test2.Table2(a,c,d) select a,c,5 from test.T ...

  4. Linux应用程序打包

      原文地址:http://blog.solrex.cn/articles/packaging-1-src.html1. 应用程序打包技术之一(源代码篇) 相信很多朋友都曾经为方便做某件事写过自己的小 ...

  5. Adding Swap Files

    Adding Swap Files If you do not have free disk space to create a swap partition and you do need to a ...

  6. Java多线程——线程的生命周期和状态控制

    一.线程的生命周期 线程状态转换图: 1.新建状态 用new关键字和Thread类或其子类建立一个线程对象后,该线程对象就处于新生状态.处于新生状态的线程有自己的内存空间,通过调用start方法进入就 ...

  7. css08盒子模型

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  8. SGU131--NYOJ435

    参考blog http://m.blog.csdn.net/blog/u012760629/36927465 http://www.cppblog.com/menrowitianya/archive/ ...

  9. request.ServerVariables获取环境变量

    Request.ServerVariables("HTTP_X_FORWARDED_FOR")  透过代理服务器取得客户端的真实IP地址,有些用此方法读取到的仍然是代理服务器的IP ...

  10. ORACLE SQL单行函数(三)【weber出品必属精品】

    16.L:代表本地货币符,这个和区域有关.这个时候我们想来显示一下人民币的符号:¥ $ vi .bash_profile ---写入如下内容: export NLS_LANG='SIMPLIFIED ...