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

Cae都过了,为毛不能AC呢?

Posted by CatLovers at 2013-11-16 12:50:27 on Problem 2249
#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:
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