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 |
为什么总OT,看代码#include <iostream> #include <math.h> using namespace std; long long N,K; int main() { long long i,s,mid,start,end; cin >> N >> K; s = 0; if( N > K ) { s += (N-K)*K; N = K; } mid = (long long)sqrt(N); for(start=N,i=K/N,end=K/(i+1);end >= mid;i++,start=K/i,end=K/(i+1)) s += ((start - end)*(K%(end+1) + K%start))/2; for(i = start;i>=1;i--) s += K%i; cout << s << endl; // cin >> s; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator