## Welcome To SDIBT ACM-ICPC Online Judge

VIRTUAL JUDGE Recent Contest F.A.Qs Forum Home ProblemSet Status Ranklist Contest LoginRegister Exam
Problem 1048. -- The Archeologists' Dilemma

## The Archeologists' Dilemma

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 2  Solved: 2
[Submit][Status][Forum]

## Description

An archaeologist, seeking proof of the presence of extraterrestrials in the Earth's past, has stumbled upon a partially destroyed wall containing strange chains of numbers. The left-hand part of these lines of digits is always intact, but unfortunately the right-hand one is often lost because of erosion of the stone. However, she notices that all the numbers with all its digits intact are powers of 2, so that the hypothesis that all of them are powers of 2 is obvious. To reinforce her belief, she selects a list of numbers on which it is apparent that the number of legible digits is strictly smaller than the number of lost ones, and asks you to find the smallest power of 2 (if any) whose first digits coincide with those of the list. Thus you must write a program that, given an integer, determines the smallest exponent E (if it exists) such that the first digits of 2E coincide with the integer (remember that more than half of the digits are missing).

## Input

Each line contains a positive integer N not bigger than 2,147,483,648.

## Output

For every one of these integers, print a line containing the smallest positive integer E such that the first digits of 2E are precisely the digits of N, or, if there isn't one, the sentence ``no power of 2".

```1
2
10```

```7
8
20

```

## Source

[Submit][Status][Forum]

HOME Back

한국어 中文 English
All Copyright Reserved 2008-2010 SDIBT TEAM
GPL2.0 2003-2010 HUSTOJ Project TEAM