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 |
这题用贪心为什么不可以?我的思路是当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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator