回复:一道程序题

来源: 2009-07-23 12:30:38 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

There is always a loop: a--b--c...--a (means a need to take b's position, etc). Using this fact you can easily get a linear algorithm.