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:交上去是WA,请告诉我哪里错了。谢谢谢谢。。。。(附代码)

Posted by AC_frantic at 2009-07-02 21:40:39 on Problem 2800
In Reply To:交上去是WA,请告诉我哪里错了。谢谢谢谢。。。。(附代码) Posted by:Noel at 2007-03-21 15:20:36
#include<iostream>
using namespace std;
int main()
{
	__int64 k,n;
	scanf("%I64d %I64d",&n,&k);
	if(n<100){
		int sum=0;
		for(int i=2; i<=n;i++)
			sum += k%i;
		printf("%d\n",sum);
	}
	else{
		int i,t;
		__int64 sum=0;
		if(n>k){
			sum =((n-k)*k);
			n = k;
		}
		for(i=2;i*3<n;i++)
			if(n>k/i)
			{
				t = k/i;
				sum += __int64(k%(t+1)+k%n)*(n-t)/2;
				n = t;
		}
		for(i=2;i<=n;i++)
			sum += __int64(k%i);
		printf("%I64d\n",sum);
	}
	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