Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
果断补上代码In Reply To:dp写完才发现是个高精度 Posted by:jufusong at 2013-04-02 19:59:51 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 dp[] = new BigInteger [110] ; dp[0]=BigInteger.valueOf(1); dp[1]=BigInteger.valueOf(1); dp[2]=BigInteger.valueOf(2); for ( int i = 3 ; i <= 100 ; i ++ ) { dp[i]=BigInteger.valueOf(0); for ( int j = 0 ; j < i ; j ++ ) { dp[i]=dp[i].add(dp[j].multiply(dp[i-j-1])); } } while ( cin . hasNext ( ) ) { int x ; x = cin . nextInt ( ) ; if ( x == -1 ) { break ; } System.out.println(dp[x]) ; } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator