805d专题

cf 805d

We have a string of letters ‘a’ and ‘b’. We want to perform some operations on it. On each step we choose one of substrings “ab” in the string and replace it with the string “bba”. If we have no “ab”

CodeForces 805D Minimum number of steps

题目链接:http://codeforces.com/contest/805/problem/D 题意:给你一个字符串,你要对他进行操作,直至不能操作为止,操作的结果是,遇到ab字符串就把他变成bba,问你最少需要多少次操作 解析:其实变几个你大概就能发现规律了,ab->bba,abb->bbab->bbbba,你会发现a后面跟着几个b,那就需要变几次,而且变过以后,b的个数会翻一倍,并且放到