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

这题用贪心为什么不可以?

Posted by wangchi at 2006-03-02 15:54:26 on Problem 2738
    我的思路是当end-st>3的时候,可以选出开头的两个a[st],a[st+1]和后面的两个a[end],a[end-1]
如果 min(a[st]-a[end],a[st]-a[st+1]) >=min(a[end]-a[st],a[end-a[end-1]),则选择
a[st],否则选择a[end].
    测试了很多数据都没有错,但提交上去却wa了.请问一下究竟错在哪里?无尽感激!

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