Uva--10916 (数学)

2014-06-10 17:36:40

题意&思路:不说了,数学log没用好- -!

#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;

int main(){
    double t,fac,tf,y,k[30] = {0};
    k[2] = 3;
    fac = log(6);
    tf = 3;
    t = 4 * log(2);
    for(int i = 3; i <= 24; ++i){
        t *= 2.0;
        while(fac < t){
            fac += log(++tf);
        }
        k[i] = tf - 1;
    }
    while(scanf("%lf",&y) == 1 && y){
        printf("%.0lf\n",k[((int)y - 1960) / 10 + 2]);
    }
    return 0;
}

 

 

posted @ 2014-06-10 17:37  Naturain  阅读(118)  评论(0编辑  收藏  举报