| ||||||||||
| 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 | |||||||||
哪位帮我看一下,递归wa了!谢谢#include<stdio.h>
unsigned __int64 cc(int n,int m)
{
if(m==0)return 1;
else return (n-m+1)%m==0?unsigned __int64 (cc(n,m-1))*((n-m+1)/m):unsigned __int64 (cc(n,m-1)/m)*(n-m+1);
}//递归p(n,m)=p(n,m-1)*(n-m+1)/m;
int main()
{
int n,m;
unsigned __int64 k;
while(1)
{
scanf("%d %d",&n,&m);
if(n==0&&m==0)return 0;
k=cc(n,m);
printf("%d things taken %d at a time is %I64d exactly.\n",n,m,k);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator