Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位帮我看一下,递归wa了!谢谢

Posted by hdjay at 2010-11-22 17:09:16 on Problem 1306
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator