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

我的算法,能得到sample output

Posted by waterine at 2005-04-17 22:53:01 on Problem 2275
In Reply To:再顶一下*^_^* Posted by:FinalLaugh at 2005-03-18 23:01:13
设flip(k)是将前k个数反转的操作

就以sample output第二个为例,43251
从最大数放起,先放5
在放5之前看4在不在5前面的数里,如果不在就不管他了,只处理5一个数,把它放到最后去
实际上是4在5前面,则先flip(3)让4紧挨5,变成23451
然后看3在不在4前面,在,并且正好紧邻
2同上
看1在不在2前面,不在,所以这次处理就处理到2,flip(4);flip(5)把2345放到最后去,变成12345
然后处理1,它已经在该在的位置,结束

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