HDU 1141 Factstone Benchmark number theory water problem, factorial with sterling formula

Source: Internet
Author: User

Factstone BenchmarkTime limit:10000/5000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 1760 Accepted Submission (s): 973


Problem Descriptionamtel have announced that it'll release a 128-bit computer chip by, a 256-bit computer by 2020, a nd so on, continuing its strategy of doubling the word-size every ten years. (Amtel released a 64-bit computer in), 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 would use a new benchmark-the factstone-to advertise the vastly improved capacity of its new chips. The Factstone rating is defined to being the largest integer n such that n! Can is represented as an unsigned integer in a computer word.

Given a year 1960≤y≤2160, what would be the Factstone rating of Amtel ' s most recently released Chip?

There is 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

Sample Output
38

Don't know why, just feel the data is very water. I feel that the code I write should not go through, the result of the code:
#include <stdio.h> #include <math.h> #define MAX 210#define PI 3.14159265358979323846#define E 2.7182818284590452354int Main () {int ans[max]; int j = 1; for (int i = 0, i < MAX; ++i) {for (;; ++j) {if (0.5*log10 (2*pi* j) +j*log10 (j/e) >pow (2.0,i/10+2) *log10 (2.0)) {Ans[i] = j-1; break;}} int year, while (~SCANF ("%d", &year) && year) {printf ("%d\n", ans[year-1960]);} return 0;}

with June

HDU 1141 Factstone Benchmark number theory water problem, factorial with sterling formula

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.