Tuesday, May 3, 2011

10916 - Factstone Benchmark


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>

using namespace std;

int main()
{
    //freopen("in.txt","r",stdin);
    int y,i;
    long double sln,res;
    while(cin>>y && y)
    {
        y=(y-1960)/10;
        sln=0;
        for(i=1;;i++)
        {
            sln+=log(i);
            res=sln/log(2);
            res=log(res)/log(2)-2;
            if(y<res)
            {
                cout<<i-1<<"\n";
                break;
            }
        }
    }

    exit(0);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.