UVa 10916 - Factstone Benchmark

来源:互联网 发布:全局搜索能力强的算法 编辑:程序博客网 时间:2024/05/18 14:44
#include <cstdio>#include <cmath>int a[23];void pre(){    int i = 1, j=1;    double s1=2, s2=0;    while(i<23) {        while(s1-s2 > 1e-9) {            s2 += log2(++j);        }        a[i++] = j-1;        s1 *= 2;    }}int main() {    #ifndef ONLINE_JUDGE    freopen("in.txt", "r", stdin);    #endif    pre();    int y;    while(scanf("%d", &y) == 1 && y) {        printf("%d\n", a[(y-1960)/10 + 2]);    }    return 0;}

原创粉丝点击