也比较简单,转化为对数计算就行了
#include<stdio.h>
#include<math.h>
int main()
{
int i, a[23], n = 1;
double sum = 0, log2 = log(2);
for (i = 2; i <= 22; i++)
{
int max = 1 << i;
while (sum / log2 < max)
sum += log(n++);
a[i] = n - 2;
}
while (scanf("%d", &n), n)
printf("%d\n", a[(n - 1960) / 10 + 2]);
return 0;
}