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 |
为什么会超时??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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator