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