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

Re:为什么老超时???

Posted by chenweifeng at 2006-05-05 18:16:22 on Problem 2249
In Reply To:Re:为什么老超时??? Posted by:chenweifeng at 2006-05-05 18:09:01
#include<iostream>
using namespace std;

int main()
{
	long n,k,sum,i,j;
	while(cin>>n>>k)
	{
		if(n==0&&k==0)
			break;

		sum=1;

		if(k!=0)
			for(i=n-k+1,j=1;i<n+1;i++,j++)						
				sum = sum*i/j;

		cout<<sum<<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