zoukankan      html  css  js  c++  java
  • HDU 1023 Catalan数+高精度

    链接:HDU 1023

    /****************************************
     *       author        :  Grant Yuan
     *       time            :   2014/10/19 15:51
     *       source       :    HDU 1023
     *       algorithm :     Catalan数+高精度
     * ***************************************/
    import java.io.*; 
    import java.math.*;
    import java.util.*;
    public class Main{
    	public static void main(String args[])
    	{
    		Scanner cin=new Scanner(System.in); 
    		BigInteger []a = new BigInteger [105];
    		BigInteger t;
    		a[0]=a[1]=BigInteger.ONE;
    		for(int  i=2;i<=102;i++)
    		{
    			a[i]=a[i-1].multiply(BigInteger.valueOf(4*i-2)).divide(BigInteger.valueOf(i+1));
    		}
    		while(cin.hasNext()){
    			int n=cin.nextInt();
    			if(n==-1) break;
    			String str;
    			str=a[n].toString();
    			System.out.println(str);
    		}
    	}
    }
    


  • 相关阅读:
    P1541
    P1004
    P1006
    高精度
    数组
    递归
    顺序结构
    循环结构
    变量
    分支结构
  • 原文地址:https://www.cnblogs.com/codeyuan/p/4254409.html
Copyright © 2011-2022 走看看