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:为什么判断a[i]>a[i+1]和a[i]<a[i+1]即可??

Posted by xuguangshengqq at 2007-07-28 02:05:13 on Problem 3298
In Reply To:为什么判断a[i]>a[i+1]和a[i]<a[i+1]即可?? Posted by:hdu07t02 at 2007-07-27 19:54:43
我知道!
 你可以画折线图;
 前面比后面大 降
 后面比前面大 升
 
 且第一步只能升
 这样 折点数就一定是 最后结果
 假设后面某一点不是取与前面最近的折点作为前一个节点
 那么它一定跳过了一个折点,这样得出的结果只能比正确的结果小!


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