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 ykt836 at 2008-07-09 10:20:07 on Problem 3623
首先将所有的字符弄成一个串,将最左边记为L,最右边记为R
然后不断判断s[L]和s[R]的大小,优先输出小的

如果他们相等:
L往右找,找到一个值与s[L]不等的,记为LL
R往左找,找到一个值与s[R]不等的,记为RR
那么就分4种情况讨论
1.s[LL]>s[L] && s[RR]>s[R],优先输出距离较远的,比如LL和L的距离 比 RR和R的距离大,则输出s[L]

2.s[LL]>s[L] && s[RR]<s[R], 输出s[R]

3.s[LL]<s[L] && s[RR]>s[R], 输出s[L]

4.s[LL]<s[L] && s[RR]<s[R], 优先输出距离较近的,比如LL和L的距离 比 RR和R的距离小,则输出s[L]


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