UVA 10916-Factstone Benchmark
题目大意:自己看了几遍,没搞懂题目,看了别人的题解才知道要做什么。。给一个a,以(a-1940)/10作为2进制数的最大位数,求他能表示的最大的n!对应的n
解题思路:运算即可
#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a;
while(scanf("%d", &a) && a != 0) {
int n = (a - 1960) / 10;
double m = pow(2, n+2);
double s = 0;
while(1) {
s++;
double x =log(s)/ log(2);
m = m - x;
if(m < 0)
break;
}
s--;
printf("%.0lf\n", s);
}
return 0;
}