PKU 2661 Factstone Benchmark

http://poj.org/problem?id=2661
コンピュータのベンチマークの指標を出す。
簡単に説明すると、1960年代は4bit、1970年代は8bit、1980年代は16bitというふうに表せる正整数の範囲が10年ごとに2倍に増えていくようなシステムを考える。
このとき、与えられた年代において計算可能なn!の最大のnを求めるというような問題。

桁数を計算していく。

main(){
  int t;
  while(cin>>t,t){
    int ans=1;
    double up=(1<<(t/10-194))*log10(2);
    double tt=0;
    while(tt<up){
      tt+=log10(++ans);
    }
    cout<<ans-1<<endl;
  }
}