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 |
Re:此题不要高精,double 就可以,附代码In Reply To:此题不要高精,double 就可以,附代码 Posted by:yzhw9981 at 2010-08-22 17:00:00 # include <iostream> # include <cstdio> # include <cstring> using namespace std; double dp[51][51]; //double sum[51]; int main() { memset(dp,0,sizeof(dp)); dp[1][1]=1; //sum[1]=1; for(int i=2;i<=50;i++) { //sum[i]=0; dp[i][1]=dp[i-1][i-1]; for(int j=2;j<=i;j++) { dp[i][j]=dp[i][j-1]+dp[i-1][j-1]; // sum[i]+=dp[i][j]; } } int n; while(true) { cin>>n; if(!n) break; printf("%d %.0f\n",n,dp[n][n]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator