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 |
交上去是WA,请告诉我哪里错了。谢谢谢谢。。。。(附代码)#include<iostream> void main() { int k,n; scanf("%d %d",&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 = __int64((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); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator