【bzoj1962】模型王子

2015年3月26日1,6460

Description

Input

输入数据共一行,两个整数N,K,用一个空格隔开,具体意义如题目中所述。

Output

输出数据共一行,为最少所需要的时间S。

Sample Input

5 3

Sample Output

5

HINT

对于全部的数据,1 < = K < = 100,1 < = N < = 10^5

题解:

  https://wenku.baidu.com/view/62c94bf7ba0d4a7302763a23.html

 #include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<cstdio> using namespace std;
inline int read()
{
int x=,f=;char ch=getchar();
while(ch>''||ch<''){if (ch=='-') f=-;ch=getchar();}
while(ch<=''&&ch>=''){x=(x<<)+(x<<)+ch-'';ch=getchar();}
return x*f;
} int n,k;
int f[][]; int main()
{
n=read(),k=read();
for (int i=;;i++)
{
f[i][]=i/;
for (int j=;j<=k;j++)
f[i][j]=max(f[i-][j]+f[i-][j-],f[i-][j]+f[i-][j-])+;
if (f[i][k]>=n)
{
printf("%d\n",i);
return ;
}
}
}

最新文章

  1. C and SQL data types for ODBC and CLI
  2. AutoMapper 最佳实践
  3. Number类型方法
  4. Run Android on Your Netbook or Desktop
  5. Win10年度更新开发必备:VS2015 Update 3正式版下载汇总
  6. 实现Fragment 切换时不重新实例化
  7. Android 退出app,后台推送的服务也停止了,怎么可以做到不停止后台服务呢?
  8. 尽量多的以 const/enum/inline 替代 #define
  9. Oracle VM VirtualBox虚拟机安装系统
  10. mysql大数据高并发处理
  11. centos 用户切换
  12. wxWidgets刚開始学习的人导引(3)——wxWidgets应用程序初体验
  13. 20160126--springaop
  14. no protocol specified
  15. gitc2016——打造互联网技术狂欢盛宴
  16. 关于Sublime Text编辑器的实用技巧
  17. 7-14 backbone源码
  18. java中的JSON数据转换方法fastjson
  19. 剑指offer-学习笔记
  20. Matplotlib新手上路(下)

热门文章

  1. 转】用Nodejs连接MySQL
  2. Activiti工作流和shiro权限管理关系图
  3. linux设置ssh连接时间
  4. Farseer.net轻量级ORM开源框架 V1.x 入门篇:数据库上下文
  5. MAC加域重复跳出---&quot;talagent&quot;想使用“本地项目” 的钥匙串
  6. A Convolution Tree with Deconvolution Branches: Exploiting Geometric Relationships for Single Shot Keypoint Detection
  7. python_函数的可变参数
  8. CAD参数绘制椭圆(com接口)
  9. 解决idea开启tomcat报Configuration Error: deployment source &#39;xxx:war exploded&#39; is not valid错
  10. vue 常用功能和命令