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

为什么判断a[i]>a[i+1]和a[i]<a[i+1]即可??

Posted by hdu07t02 at 2007-07-27 19:54:43 on Problem 3298
AC的,但不知道怎么证明
if(a[i] > a[i+1])
{
  s = 1;
  t ++;
  for(j=i+1;j<=n;j++)
  {
    if( s==1&&a[i]<a[i+1] || s==0&&a[i]>a[i+1] )
    {
      t ++;
      s^= 1;
    }
  }
  if(t > max) max = t;
}

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