【SRM597】Div2 Easy, Medium解いた【Python】

Div2 Easy 2倍しまくったら全部同じ数になるか

You are given an tuple (integer) A. On a single turn, Little Elephant can double (i.e., multiply by 2) any element of A. He may double the same element more than once, if he wants to. He wants to obtain an array in which all elements are equal. Return "YES" (quotes for clarity) if it is possible to do that and "NO" otherwise.

一番大きい数字に合わせて2倍しまくる。

SRM597 Div2 easy

Div2 Medium いくつ前に持ってくるか

You are given a string A and a string B of the same length. In one turn Little Elephant can choose any character of A and move it to the beginning of the string (i.e., before the first character of A). Return the minimal number of turns needed to transform A into B. If it's impossible, return -1 instead.

Bを後ろからみていって、Aの動かさなくていい部分を数える。

SRM597 Dic2 Medium