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 |
Re:交上去是WA,请告诉我哪里错了。谢谢谢谢。。。。(附代码)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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator