701-the Archeologists ' dilemma
Time limit:3.000 seconds
Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_ problem&problem=642
An archeologist seeking proof of the presence of extraterrestrials in the Earth ' s past, stumbles upon a partially Destroye D wall containing strange chains of numbers. The left-hand part of this lines of digits is always intact, but unfortunately the right-hand one was often lost by Erosio N of the stone. However, she notices, all of the numbers and all it digits intact are powers of 2, so this hypothesis, all of t Hem are powers of 2 is obvious. To reinforce her belief, she selects a list of numbers in which it is apparent this number of legible digits is strict Ly smaller than the number of lost ones, and asks you to find the smallest power of-2 (if any) whose a-digits With those of the list.
Thus must write a program such this given an integer, it determines (if it exists) the smallest exponentE suc h that the ' the ' 2E coincide with the digits (remember, more than half of the digits are).
Input
It is a set of the lines with a positive the integer N not bigger than 2147483648 in each of them.
Output
For every one of those integers a line containing the smallest positive integer E such that the the ' a ' of 2 E are precisely the digits of N, or, if there is no one, the sentence 'No. 2'.
Sample Input
1
2
10
Sample Output
7
8
20