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 |
发一下自己的思路,不知哪里想错了,求大牛改正首先将所有的字符弄成一个串,将最左边记为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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator