UVA 10916 Factstone Benchmark

#include <cstdio>
#include <cmath>

int main() {
	int year;
	while (scanf("%d", &year), year) {
		int n = (year - 1940) / 10;
		double k = pow(2.0, n) * log(2.0);
		double sum = 0;
		int i;
		for (i = 1; sum <= k; i++) {
			sum += log(i*1.0); 
		}
		printf("%d\n", i - 2);
	}
	return 0;
}

你可能感兴趣的:(UVA 10916 Factstone Benchmark)