Va 10916-factstone Benchmark

Source: Internet
Author: User
Document directory
  • Sample Input
  • Output for sample input
Problem B: factstone Benchmark

Amtel has announced that it will release a 128-bit computer chip by 2010, a 256-bit computer by 2020, and so on, continuing its strategy of doubling the word-size every ten years. (amtel released a 64-bit computer in 2000, a 32-bit computer in 1990, a 16-bit
Computer in 1980, an 8-bit computer in 1970, and a 4-bit computer, its first, in 1960 .)

Amtel will use a new benchmark-Factstone-To advertise the vastly improved capacity of its new chips.
FactstoneRating is defined to be the largest integerNSuch that
N!Can be represented as an unsigned integer in a computer word.

Given a year1960 ≤ y ≤ 2160, What will beFactstoneRating of amtel's most recently released chip?

There are several test cases. For each test case, there is one line of input containing
Y. A line containing 0 follows the last test case. For each test case, output a line giving the factstone rating.

Sample Input
196019810
Output for sample input
38

Calculate the maximum value of N, 2 ^ n> N !, I have previously done some silly questions and I forget n! It is very difficult to cross-border, and the logarithm can be used to solve the problem.

LG (2 ^ N)> LG (N !)

N * lg2> lg1 + ...... lgn

# Include <stdio. h>
# Include <math. h>
Void main ()
{Int N, I;
Double M, S;
While (scanf ("% d", & N), n)
{M = POW (2, (n-1940)/10) * log (2 );
S = 0;
For (I = 1; S <m; I ++)
S + = Log (I );
Printf ("% d \ n", I-2 );
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.