Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

那我就实在不知道为什么RE了?

Posted by jackie_wyx at 2006-12-11 13:25:06 on Problem 3104
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator