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 |
终于找到错在哪了。。。#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator