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

为什么会超时??

Posted by 913106840245 at 2015-01-07 10:18:19 on Problem 2249
long long solve(long long n,long long k){
	long long x=n-k+1;
	long long res=1;
	for(long long y=2;x<=n;x++){
		res*=x;
		while(x%y==0 && y<=k){
			x/=y;
			y++;
		}
	}
	return res;
}
int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
	long long n,k;
	while(cin>>n>>k){
		if(n==0 && k==0) break;
		cout<<solve(n,k)<<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