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 |
用递归做的,,但是超时,,,,,:)#include <stdio.h> int work(int m,int n) { if(n==0)return(m); if(m==1)return(1); return(1+work(m-1,n-1)+work(m-1,n)); } void main() { int m,n,no=1; do { scanf("%d%d",&m,&n); if(m==0&&n==0)break; printf("Case %d: %d\n",no,work(m,n)); no++; } while(1); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator