UVA 10916 - Factstone Benchmark
来源:互联网 发布:java获取自己程序名字 编辑:程序博客网 时间:2024/05/23 16:54
大致题意:求出最大m使得m! <= 2^n, 其中n=4<<(t-1960) /10),t为输入的数字,1960<=t<=2160输入0结束。
分析:两边同时取对数有(log1 + log2 + log 3 + .... + log4) / log2<= n,对前面的求和比较找出m就可以了
总结:数学还是要好好看啊。。。
代码:
#include<iostream>
#include<cstdio>
#include<cmath>
usingnamespace std;
intmain()
{
int t;
while (scanf("%d", &t), t !=0)
{
int n = 4 << ((t - 1960) / 10);
double m = 0;
int i = 1;
for (i = 1; m <= n ; i++)
m += log(1.0 * i) / log(2.0);
printf("%d\n", i - 2);
}
return 0;
}
- UVa 10916 Factstone Benchmark
- uva 10916 Factstone Benchmark
- UVA 10916 - Factstone Benchmark
- UVa 10916 - Factstone Benchmark
- uva 10916 - Factstone Benchmark
- uva-10916 - Factstone Benchmark
- Uva 10916 - Factstone Benchmark
- uva 10916 - Factstone Benchmark
- UVa 10916 - Factstone Benchmark
- UVA 10916 Factstone Benchmark
- uva 10916 Factstone Benchmark
- UVa 10916 Factstone Benchmark
- UVa 10916 - Factstone Benchmark
- UVa 10916 - Factstone Benchmark
- UVa 10916 - Factstone Benchmark
- UVa 10916 - Factstone Benchmark
- UVA 10916 Factstone Benchmark
- UVA - 10916 Factstone Benchmark
- jquery 遍历数组each的用法,还有一个jquery的基础用法
- excel 宏补全第一列值
- UIBarButtonItem使用困惑
- Eclipse安装TestNG插件
- 求第1500个只有2,3,5因子的数
- UVA 10916 - Factstone Benchmark
- jQuery操作input
- Android 访问不受信任的HTTPS,无需证书
- setCharacterEncoding
- 在Eclipse中遇到The type XXX cannot be resolved. It is indirectly referenced from required .class files错误
- 最大子段和 C语言源码
- Objective-C最基础语法之基础类型
- 使用spring发送邮件
- FL2440无操作系统应用程序编写测试012——DMA