Train Problem II
来源:互联网 发布:淘宝aj厂货最好店 编辑:程序博客网 时间:2024/05/08 02:42
Train Problem II
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6680 Accepted Submission(s): 3626
Problem Description
As we all know the Train Problem I, the boss of the Ignatius Train Station want to know if all the trains come in strict-increasing order, how many orders that all the trains can get out of the railway.
Input
The input contains several test cases. Each test cases consists of a number N(1<=N<=100). The input is terminated by the end of file.
Output
For each test case, you should output how many ways that all the trains can get out of the railway.
Sample Input
12310
Sample Output
12516796HintThe result will be very large, so you may not process it by 32-bit integers.
import java.math.BigInteger;import java.util.Scanner;public class Main {public static void main(String[] args){int n;Scanner cin=new Scanner(System.in);BigInteger []k=new BigInteger[107];k[0]=BigInteger.valueOf(1);for(int i=1;i<=100;i++){k[i]=BigInteger.valueOf(0);for(int j=0;j<=i-1;j++){k[i]=k[i].add(k[j].multiply(k[i-j-1]));}}while (cin.hasNext()){n=cin.nextInt();System.out.println(k[n]);}}}
0 0
- Train Problem II
- 1023:Train Problem II
- 1023 Train Problem II
- HDU Train Problem II
- hdu Train Problem II
- hdu1023-Train Problem II
- hdu Train Problem II
- Train Problem II
- Train Problem II
- Train Problem II
- Train Problem II
- HOJ Train Problem II
- hdoj1023 Train Problem II
- Train Problem II
- hdu 1023 Train Problem II
- HDOJ 1023 Train Problem II
- HDOJ 1023 Train Problem II
- HDU-1023 Train Problem II
- con和com开头单词
- Mysql提示134错误
- Boolean数据类型.
- 文件的读写操作1
- oracle时间处理
- Train Problem II
- 一步一步写算法(之链表排序)
- ios中的category与extension
- c语言二维数组和指针详解
- java中间件学习2-java jvm了解
- 机器学习的一些通俗易懂的tutorial
- 为什么做java的web开发我们会使用struts2,springMVC和spring这样的框架?
- UITableView优化
- Unity通过射线碰撞选择模型,然后控制模型的移动、旋转、缩放等动作