Factstone Benchmark hoj 数学题
生活随笔
收集整理的這篇文章主要介紹了
Factstone Benchmark hoj 数学题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/*題意是求滿足n!<2^bit的最大n。只能題意太特么晦澀了。
然后可以轉化一下。1*2*3...*n<2*2*2...*2.
則循環2^bit次。n=(2^bit)/(n-1)!。
每步運算的時候,滿足sum>k,就k++,將sum/=k。*/
#include <stdio.h>
#include <cstring>
#include <cmath>
int main()
{int n;while(scanf("%d",&n)==1&&n){n=1<<((n-1960)/10+2);double sum=1.0;int k=0;for(int i=1;i<=n;i++){sum*=2;if(sum>k){k++;sum/=k;}}printf("%d\n",k);}return 0;
}
總結
以上是生活随笔為你收集整理的Factstone Benchmark hoj 数学题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OkHttp源码解析(上)
- 下一篇: 2020年度DeFi行业分析报告发布!