poj2661Factstone Benchmark
利用log函数来求解 n!<=2^k k会达到400+W 暴力就不要想了,不过可以利用log函数来做
log2(n!) = log2(1)+log2(2)+..log2(n)<=k
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
#define N 100000
#define LL long long
#define INF 0xfffffff
const double eps = 1e-;
const double pi = acos(-1.0);
const double inf = ~0u>>;
int main()
{
int i,j,n;
//cout<<log10(10)<<" "<<log(10)<<endl;
while(cin>>n)
{
if(!n) break;
LL k = ;
for(i = ; i <= n ; i+=)
k*=;
double d=;
int ans;
for(i = ; ; i++)
{
d+=log10(i*1.0)/log10(2.0);
if(d>k)
{
ans = i-;
break;
}
}
cout<<ans<<endl;
}
return ;
}
poj2661Factstone Benchmark的更多相关文章
- POJ-2661Factstone Benchmark
Factstone Benchmark Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5577 Accepted: 25 ...
- mysql benchmark基准测试
git项目地址: https://github.com/akopytov/sysbench 利用sysbench很容易对mysql做性能基准测试(当然这个工具很强大,除了测试主流数据库性能,还能测试其 ...
- Kafka设计解析(五)- Kafka性能测试方法及Benchmark报告
本文转发自Jason’s Blog,原文链接 http://www.jasongj.com/2015/12/31/KafkaColumn5_kafka_benchmark 摘要 本文主要介绍了如何利用 ...
- Azure Redis Cache (3) 在Windows 环境下使用Redis Benchmark
<Windows Azure Platform 系列文章目录> 熟悉Redis环境的读者都知道,我们可以在Linux环境里,使用Redis Benchmark,测试Redis的性能. ht ...
- CI框架源码阅读笔记5 基准测试 BenchMark.php
上一篇博客(CI框架源码阅读笔记4 引导文件CodeIgniter.php)中,我们已经看到:CI中核心流程的核心功能都是由不同的组件来完成的.这些组件类似于一个一个单独的模块,不同的模块完成不同的功 ...
- Multiple sequence alignment Benchmark Data set
Multiple sequence alignment Benchmark Data set 1. 汇总: 序列比对标准数据集: http://www.drive5.com/bench/ This i ...
- [转] CentOS单独安装Apache Benchmark压力测试工具的办法
Apache安装包中自带的压力测试工具 Apache Benchmark(简称ab) 简单易用,这里就采用 ab作为压力测试工具了. 1.独立安装 ab运行需要依赖apr-util包,安装命令为: 1 ...
- Visual Tracker Benchmark
直接的方法: 首先将代码先拷到benchmark_v1.0/tackers/这个文件夹下,你会发现里面已有好几个算法的代码文件夹了. 这边注意了,我就是这样的,没有注意把代码拷贝进去之后要自己写一个调 ...
- benchmark
redis benchmark How many requests per second can I get out of Redis? Using New Relic to Understand R ...
随机推荐
- DosBox 报错 this program requires dosxnt.exe to be in your path
也就是少了dosxnt.exe文件,能够上网搜索下载,把dosxnt 拷贝到你挂截文件夹下就能够执行 Dosxnt文件下载
- Android——SlidingMenu学习总结
来源 SlidingMenu是github上比較火开源库.很强大,不但但是简单的设置实现两側滑动菜单,还能够设置菜单的阴影.渐变色.划动模式等. 下载地址:https://github.com/jfe ...
- 使用python在极坐标中生成一条直线
在测试雷达时,往往需要测试雷达的数据是否准确,这时就需要在雷达图中显示一条标准的直线作为对比. "create a wall" import numpy as np import ...
- C语言-- static 全局使用示例
C语言-- static 全局使用示例 前言:看到很多使用Objective-C开发IOS的大牛,有时候会使用static全局变量,相比之下,我却很少用这个,从而很少对其有着比较有实质意义的理解,甚 ...
- 【iOS系列】-A server with the specified hostname could not be found.问题解决
[iOS系列]-A server with the specified hostname could not be found.问题解决 Reveal 在iOS开发中可以方便查看界面的布局,较为方便的 ...
- 基于Cocos2dx + box2d 实现的愤慨的小鸟Demo
1. Demo初始界面 2. 游戏界面 3. 精确碰撞检測 4. 下载 压缩文件文件夹 AngryBird source 愤慨的小鸟Demo源码,基于Cocos2dx C++,以及box2d技 ...
- YTU 2553: 谁是赢家
2553: 谁是赢家 时间限制: 1 Sec 内存限制: 128 MB 提交: 94 解决: 25 题目描述 某一天,hcbbt等一群弱菜去tamara巨巨家里一起玩了一个卡牌游戏.巨 巨家里有2 ...
- fcitx-configtool
配置输入法
- Struts2中怎样配置struts。xml?
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-/ ...
- sharepoint2013安装AppFabric出错
手动安装AppFabric "d:\WindowsServerAppFabricSetup_x64.exe" /i CacheClient,CachingService,Cache ...