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. AES - Rijndael 算法(一)

    1997年1月,美国标准技术协会NIST开始遴选数据加密标准(Data Encryption Standard,简称DES)替代者的工作,称为高级加密标准[1’2](Advanced Enerypti ...

  2. XSLT学习

    XSL 语言 XSL(eXtensible Stylesheet Language)是可扩展样式表语言,是一种用于以可读格式呈现 XML(标准通用标记语言的子集)数据的语言. XSL与xml CSS ...

  3. oracle for update和for update nowait

    原文地址:http://www.cnblogs.com/quanweiru/archive/2012/11/09/2762223.html 1.for update 和 for update nowa ...

  4. Java多线程编程(一)

    1.Java创建多线程的方法一:(1)实现Runnable接口并实现其中的run()方法:(2)将Runable对象提交给一个Thread构造器,调用start()方法. [程序实例]单线程 publ ...

  5. Object -C NSSet -- 笔记

    // //  main.m //  NSSET // //  Created by facial on 25/8/15. //  Copyright (c) 2015 facial_huo. All ...

  6. Android项目实战--手机卫士18--读取用户的短信内容以及短信备份

    我们今天要说的就是我们手机卫士里面的高级工具里面的短信备份功能啦,其实这个软件备份的功能也很简单,就是把用户的短信读出来,然后写到一个xml或者数据库里面, 但我们这里的是读取到xml里面的. 首先我 ...

  7. Easyui弹出窗体在iframe的父级页面显示

    今天做EasyUI学习的预到了一个这样的问题:通过iframe加载的一个页面在调用$.messager.alert();这个方法后只能在iframe中显示alert效果而不是在全局的页面上显示这并不我 ...

  8. [转] Linux写时拷贝技术(copy-on-write)

    PS:http://blog.csdn.net/zxh821112/article/details/8969541 进程间是相互独立的,其实完全可以看成A.B两个进程各自有一份单独的liba.so和l ...

  9. 线段树---HDU1754 I hate it

    这个题也是线段树的基础题,有了上一个题的基础,在做这个题就显得比较轻松了,大体都是一样的,那个是求和,这个改成求最大值,基本上思路差不多,下面是代码的实现 #include <cstdio> ...

  10. 计算方法(一)用C#实现数值迭代

    平时,经常会遇到解方程,计算方法中常用的有二分法(精度太低,迭代次数多,一般没人用),牛顿迭代法,弦截法,网上大多都是C++或者Java的实现代码,很少有C#的,我在本科毕业论文中用到了这些,那时也需 ...