poj2661 Factstone Benchmark 数学

题目链接:http://poj.org/problem?id=2661

吴永辉《算法设计编程实验》1.1.1

 1 ///2014.4.12
 2 ///poj2661
 3 
 4 #include <iostream>
 5 #include <cstdio>
 6 #include <string>
 7 #include <cmath>
 8 using namespace std;
 9 
10 int main()
11 {
12     // freopen("in","r",stdin);
13     // freopen("out","w",stdout);
14 
15     int a;
16     while( cin>>a && a ){
17         int k = 4;
18         for(int i=1960 ; i/10<a/10 ; i+=10)
19             k *= 2;
20         int n=1;
21         double sum = 0;
22         for(n=1 ; sum<k ; n++){
23             sum += log( (double)n )/log( (double)2 );
24         }
25         n -= 2;
26         cout<<n<<endl;
27     }
28     return 0;
29 }

 

posted @ 2014-04-12 11:01  basement_boy  阅读(156)  评论(0编辑  收藏  举报