bzoj 1962 硬币游戏 (猜数问题)
2024-08-30 20:23:36
【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 ;
}
}
}
最新文章
- C and SQL data types for ODBC and CLI
- AutoMapper 最佳实践
- Number类型方法
- Run Android on Your Netbook or Desktop
- Win10年度更新开发必备:VS2015 Update 3正式版下载汇总
- 实现Fragment 切换时不重新实例化
- Android 退出app,后台推送的服务也停止了,怎么可以做到不停止后台服务呢?
- 尽量多的以 const/enum/inline 替代 #define
- Oracle VM VirtualBox虚拟机安装系统
- mysql大数据高并发处理
- centos 用户切换
- wxWidgets刚開始学习的人导引(3)——wxWidgets应用程序初体验
- 20160126--springaop
- no protocol specified
- gitc2016——打造互联网技术狂欢盛宴
- 关于Sublime Text编辑器的实用技巧
- 7-14 backbone源码
- java中的JSON数据转换方法fastjson
- 剑指offer-学习笔记
- Matplotlib新手上路(下)
热门文章
- 转】用Nodejs连接MySQL
- Activiti工作流和shiro权限管理关系图
- linux设置ssh连接时间
- Farseer.net轻量级ORM开源框架 V1.x 入门篇:数据库上下文
- MAC加域重复跳出---";talagent";想使用“本地项目” 的钥匙串
- A Convolution Tree with Deconvolution Branches: Exploiting Geometric Relationships for Single Shot Keypoint Detection
- python_函数的可变参数
- CAD参数绘制椭圆(com接口)
- 解决idea开启tomcat报Configuration Error: deployment source &#39;xxx:war exploded&#39; is not valid错
- vue 常用功能和命令