CF910B
题解:
dp
f[i][j]表示i根a,j根b要多少
然后随便转移一下
代码:
#include<bits/stdc++.h>
using namespace std;
int f[][],n,a,b;
int main()
{
scanf("%d%d%d",&n,&a,&b);
memset(f,0x3f,sizeof f);
f[][]=;
for (int i=;i<=;i++)
for (int j=;j<=;j++)
for (int k=;k<=i;k++)
if (k*a<=n)f[i][j]=min(f[i][j],f[max(i-k,)][max(j-(n-k*a)/b,)]+);
printf("%d",f[][]);
}
CF910B的更多相关文章
随机推荐
- Spring-1-F Dice(HDU 5012)解题报告及测试数据
Dice Time Limit:1000MS Memory Limit:65536KB Description There are 2 special dices on the table. ...
- javascript对象继承
一.实例化和继承的区别 构造函数.原型和实例的关系:每 个构造函数都有一个原型对象,原型对象都包含一个指向构造函数的指针,而实例都包含一个指向原型 对象的内部指针. 类(Class)和实例(Insta ...
- 移植gdb到海思3716板子的方法【转】
本文转载自:https://blog.csdn.net/yuhengyue/article/details/78414403 一,移植方法 环境:ubuntu12.04 交叉编译工具链路径:/opt/ ...
- SpringBoot 集成Netty实现UDP Server
注:ApplicationRunner 接口是在容器启动成功后的最后一步回调(类似开机自启动). UDPServer package com.vmware.vCenterEvent.netty; im ...
- sql 筛选表中指定字段包含26某个小写字母
SELECT *from 表名WHERE 字段 COLLATE Chinese_PRC_CS_AS LIKE '%[abcdefghijklmnopqrstuvwxyz]%'筛选表中指定字段包含26某 ...
- springMVC注解的参数传递
1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=&qu ...
- 秒懂算法2——选择排序(C#实现)
算法思路: 每趟走访元素揪出一个最小(或最大)的元素,和相应位置的元素交换.(用数组{6,9,13,2,4,64} 举例) {},{6 9 13 [2] 4 64} //第一趟,揪出2 {2} ...
- LA 7272 Promotions(dfs)
https://vjudge.net/problem/UVALive-7272 题意: 公司要提拔人,现在有n个人,现在有m条有向边,A->B表示A的表现比B好,也就是如果B晋升了,那么A肯定会 ...
- java 之 find 命令
转自:https://blog.csdn.net/holyshit666/article/details/52296966 find命令是比较常用的命令,用来在特定目录下查找具有某种特征的文件. 一: ...
- Git出现fatal: Unable to find remote helper for 'https'
使用Git远程获取代码 git clone https://github.com/twlkyao/findfile.git 出现“fatal: Unable to find remote helper ...