The Archeologists' Dilemma

2020年1月17日 1363点热度 0人点赞 0条评论

The Archeologists' Dilemma

时间: 1ms        内存:64M

描述:

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).

输入:

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

输出:

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



提示:

参考答案:

解锁文章

没有看到答案?微信扫描二维码可免费解锁文章

微信扫描二维码解锁

使用微信扫描二维码打开广告页面后可以立即关闭,再刷新此页面即可正常浏览此文章

所跳转广告均由第三方提供,并不代表本站观点!

已经扫描此二维码?点此立即跳转

code

这个人很懒,什么都没留下

文章评论