文件名称:ABstring1518
介绍说明--下载内容均来自于网络,请自行研究使用
假设a移到最左端,那么步骤 : 第一个a移到最左端,然后第二个移到最左端,....从左到右,先后顺序,这样肯定移动次数最少
同理,假设b移到最左端,那么步骤也是一样的,从左到又一个一个往左移动
am 表示最左边已经有 a字符的个数
sa 表示a往最左边移动,已经耗费的移动次数
bm 和 sb 和上面的概念对应
注意,其实根本就没有真正的移动,只是假设性的移动,用i-am和i-bm分别计算a和b移到左端的操作次数
设s[0]表示第一个字符,就是a字符
不等于s[0]的就是第二个字符,就是b字符*/-Assume that a move to the left, then the steps: first a move to the left, then move to the extreme left ,.... second from left to right order, so surely the least number of moves Similarly, if b shift to the left, then the procedure is the same, from left to another one moves to the left am, said the left-most characters have a number of sa that a move to the left, the movement has been spent and the number of bm sb and the concept of the above corresponding to the note, the fact is there is no real movement, but the hypothetical movement, with i-am and i-bm a and b were calculated move to the left of the number of operations set s [0] for the first character is a character not equal to s [0] is the second character is the b character* /
同理,假设b移到最左端,那么步骤也是一样的,从左到又一个一个往左移动
am 表示最左边已经有 a字符的个数
sa 表示a往最左边移动,已经耗费的移动次数
bm 和 sb 和上面的概念对应
注意,其实根本就没有真正的移动,只是假设性的移动,用i-am和i-bm分别计算a和b移到左端的操作次数
设s[0]表示第一个字符,就是a字符
不等于s[0]的就是第二个字符,就是b字符*/-Assume that a move to the left, then the steps: first a move to the left, then move to the extreme left ,.... second from left to right order, so surely the least number of moves Similarly, if b shift to the left, then the procedure is the same, from left to another one moves to the left am, said the left-most characters have a number of sa that a move to the left, the movement has been spent and the number of bm sb and the concept of the above corresponding to the note, the fact is there is no real movement, but the hypothetical movement, with i-am and i-bm a and b were calculated move to the left of the number of operations set s [0] for the first character is a character not equal to s [0] is the second character is the b character* /
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ABstring1518.docx