UVa 10916 Factstone Benchmark

 1  #include <stdio.h>
 2  #include <stdlib.h>
 3  #include <iostream>
 4  #include <algorithm>
 5  #include <math.h>
 6  using namespace std;
 7  int main()
 8  {
 9      int n;
10      while(cin >> n && n!=0)
11      {
12          double k=4;
13          for(int i=1970;i<=n;i+=10)
14          {
15              k*=2;
16          }
17          double f=0;
18          int d=1;
19          while(f<k)
20          {
21              f+=log2((double)++d);
22          }
23          printf("%d\n",d-1);
24      }
25      return 0;

26  }

留言

這個網誌中的熱門文章

Things a Little Bird Told Me: Confessions of the Creative Mind

UVa 12970 Alcoholic Pilots

UVa 483 Word Scramble