| ||||||||||
| 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啊,大牛门帮看看啊T_T``另外时间越界是什么意思啊?#include <stdio.h>
void main()
{
int a[100000],i,n,k,mid,sum,min,max;
while((scanf("%d",&n))!=EOF)
{
min=0;
max=1;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]>max) max=a[i];
}
scanf("%d",&k);
if(k!=1)
{
while(min<=max)
{
sum=0;
mid=(max+min)>>1;
for(i=0;i<n;i++)
{
if(a[i]>mid)
{
sum+=(a[i]-mid-1)/(k-1)+1;
}
}
if(sum>mid) min=mid+1;
else max=mid-1;
}
max++;
}
printf("%d\n",max);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator