可以把
int xjc = 1, yjc = 1,zjc = 1
改为
double xjc = 1, yjc = 1,zjc = 1
你用的卖仔差是递规,爆栈了。#include<中皮stdio.h>
unsigned int C(unsigned int n,unsigned int r)
int main()
{
unsigned int n,r,i
for(i=0scanf("%d%d",&n,&r)!=EOFi++)
{
if(n==0&&r==0)
{
break
}
if(n<r)
{printf("error!\n"戚镇)}
else
printf("%d\n",C(n,r))
}
return 0
}
unsigned int C(unsigned int n,unsigned int r)
{
unsigned int i,ans[100]
if(r==0)return 1
if(r==1)return n
ans[0]=1,ans[1]=n
for(i=2i<=ri++)
{
ans[i]=ans[i-1]*(n-i+1)/i
}
return ans[r]
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)