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了?In Reply To:Re:此种理解能力…… Posted by:frkstyc at 2006-12-10 23:02:45 #include <stdio.h> main() { __int64 a[100010]; __int64 i,n,k,t,sum,tb,te; while((scanf("%I64d",&n))!=EOF) { tb=1; te=0; for(i=1;i<=n;i++) { scanf("%I64d",&a[i]); if(a[i]>te) te=a[i]; } scanf("%I64d",&k); while(tb!=te) { sum=0; t=(tb+te)/2; for(i=1;i<=n;i++) { if(a[i]>t) sum+=((a[i]-t-1)/(k-1))+1; } if(sum>t) tb=t+1; else te=t; } printf("%I64d\n",te); } return(0); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator