| ||||||||||
| 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 | |||||||||
怕精度 不够,就用 Double ~~~
支持 Double ~~~~~
810974380 2249 Accepted 168K 0MS C
#include<stdio.h>
#include<stdlib.h>
double fab(long m,long n)
{ double ans=1,w=1;long i;
if(n>m/2) n=m-n;
for(i=n;i>=1;i--)
{
w*=(m-n+i);
if((int)w%i==0) w/=i;
else ans*=i;
}
return w/ans;
}
int main()
{long a,b;
while(scanf("%ld%ld",&a,&b))
{if(a==0&&b==0) break;
printf("%0.f\n",fab(a,b));
}
system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator