| ||||||||||
| 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 | |||||||||
答案比较大,double不够In Reply To:用组合数学数公式Pk(n+k)怎么会错呢!!不懂?? Posted by:ecjtubaowp at 2007-01-25 14:55:26 > #include<stdio.h>
> double a[1001][1001];
> int main()
> {
> int i,j,n,m,k,b;
> double sum;
> for(i=1;i<=1000;i++)
> {
> for(j=1;j<=100;j++)
> {
> if((i==j)||(j==1)){a[i][j]=1;continue;}
> if(i>j)
> {
> for(b=1;b<=j;b++)
> a[i][j]+=a[i-j][b];
> }
> if(i<j)a[i][j]=0;
>
> }
> }
> scanf("%d%d",&n,&k);
> sum=0;
> for(i=1;i<=k;i++)
> sum+=a[n][i];
> printf("%.0lf\n",sum);
> //while(1);
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator