Title: Given y, the maximum value of K ((y-1960)/10+2) > k! is satisfied.
Problem-solving ideas: Through the two sides at the same time to the logarithm, to achieve the effect of power, so that the number of both sides can be stored with their own type.
After taking the logarithm: 2 ((y-1960)/10+2) * Log (2) > Log (k!).
Further conversions: 2 ((y-1960)/10+2) > log (k!)/log (2) = log (k)/log (2) + log (k-1)/log (2) + log (k-2)/log (2) + ... +log (1)/log (2).
Due to Y <= 2160, the desired (y-1960)/10+2 <= 22, so the Left 2 ((y-1960)/10+2) <=222. In the self-contained type bearing.
The final traverse to solve K can
The code is as follows:
1#include <cstdio>2#include <cmath>3 4 5 //Reference:http://www.lxway.com/18542861.htm6 7 //2^ (2^ ((y-1960)/10+2) > k!8 //2^ ((y-1960)/10+2) * Log (2) > log (k!) = log (k) + log (k-1) + log (k-2) + ... + log (1)9 intBenchmarkinty) {Ten intE = (Y-1960) /Ten+2; One intleft =1<<e; A intK =0; - Doubleres =0; - while(Left >Res) { theRes + = log (++k)/log (2); - } - return--K; - } + - intMain () { + inty; A while(SCANF ("%d", &y) { at intK =benchmark (y); -printf"%d\n", k); - } - return 0; -}
Reference:
Sicily 1190. Factstone Benchmark
SOJ 1119. Factstone Benchmark