| ||||||||||
| 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 | |||||||||
Cae都过了,为毛不能AC呢?#include<iostream>
using namespace std;
int gcd(int a,int b)
{
if( b ==0)
return a;
else
return gcd(b,a%b);
}
int main()
{
int n,m;
while( scanf("%d%d",&n,&m) && n)
{
if( m > n/2 )
m =n -m;
double a =1,b =1;
for(int i=n;i>=n-m+1;i--)
b *= ( 1.0*i/( (i-n+m)*1.0 ) ); //按照组合公式来写的
cout<<(int)b<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator