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 kuailezhish at 2012-03-08 22:12:41 on Problem 2800
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define lld long long

lld N,K;

int main(){
	lld i,j,k,tem,ans;
	while (~scanf("%lld%lld",&N,&K)){
		ans=N*K;
		for (i=1; i<=N && i<=K;){
			k=K/i;
			j=K/k;						// 用K-K/i*i求的模
			if (j>N) j=N;				//这句没加,错了几次。。。
			ans-=(j-i+1)*(i+j)/2*k;		//K/(i...j)=k;
			i=j+1;
		}
		printf("%lld\n",ans);
	}
	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