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:FOXLIU at 2008-09-21 01:00:16 #include <stdio.h> int num(int x,int y) { if(y==0) return 1; else if(x==1&&y>=0&&y<=9) return 1; else if(y>=10) return num(x-1,y)+num(x,y-1)-num(x-1,y-10); else return num(x-1,y)+num(x,y-1); } int main() { int n,i,j,sum=0; scanf("%d",&n); i=n/2; for(j=0;j<=9*i;j++) sum+=num(i,j)*num(i,j); printf("%d\n",sum); return 0; } 数据严重出错啊= = Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator