随笔分类 -  动态规划

摘要:#include <iostream> #include <vector> using namespace std; class BackPack{ public: /* 背包1: * 给定N个物品,重量分别为正整数 * 一个背包的最大承重为整数M * 最多能带走多重的物品 * */ static 阅读全文
posted @ 2021-09-19 21:59 蘑菇王国大聪明 阅读(28) 评论(0) 推荐(0) 编辑
摘要:// // Created by Administrator on 2021/7/27. // #ifndef C__TEST01_BESTTIMETOBUYANDSELLSTOCK_HPP #define C__TEST01_BESTTIMETOBUYANDSELLSTOCK_HPP #inclu 阅读全文
posted @ 2021-07-31 21:51 蘑菇王国大聪明 阅读(63) 评论(0) 推荐(0) 编辑
摘要:// // Created by Administrator on 2021/7/27. // #ifndef C__TEST01_HOUSEROBBER2_HPP #define C__TEST01_HOUSEROBBER2_HPP #include <iostream> #include <ve 阅读全文
posted @ 2021-07-27 19:10 蘑菇王国大聪明 阅读(19) 评论(0) 推荐(0) 编辑
摘要:// // Created by Administrator on 2021/7/27. // #ifndef C__TEST01_HOUSEROBBER_HPP #define C__TEST01_HOUSEROBBER_HPP #include <iostream> #include <vect 阅读全文
posted @ 2021-07-27 19:09 蘑菇王国大聪明 阅读(24) 评论(0) 推荐(0) 编辑
摘要:// // Created by Administrator on 2021/7/27. // #ifndef C__TEST01_PAINTHOUSE_HPP #define C__TEST01_PAINTHOUSE_HPP #include <vector> class PaintHouse { 阅读全文
posted @ 2021-07-27 19:08 蘑菇王国大聪明 阅读(32) 评论(0) 推荐(0) 编辑
摘要:// // Created by Administrator on 2021/7/25. // #ifndef C__TEST01_BOMBENEMY_HPP #define C__TEST01_BOMBENEMY_HPP #include <iostream> #include <vector> 阅读全文
posted @ 2021-07-27 19:07 蘑菇王国大聪明 阅读(253) 评论(0) 推荐(0) 编辑
摘要:1.问题描述 给定m行n列的网咯,每个格子(i,j)里都一个非负数A[i][j] 求一个从左上角(0,0)到右下角的路径,每一部只能向下或者向右走一步 使得路径上的格子里的数字之和最小 输出最小数字和 例如: { {1, 5, 7, 6, 8} {4, 7, 4, 4, 9} {10, 3, 2, 阅读全文
posted @ 2021-07-25 19:35 蘑菇王国大聪明 阅读(48) 评论(0) 推荐(0) 编辑
摘要:1.问题描述 有一段由A-Z组成的字母串信息被加密成数字串 加密方式为A->1,B->2,...,Z->26 给定加密后的字符串S[1...N-1],问有多少种方式解密成字母串 例子: 输入: -12 输出: -2(AB或L) 2.代码 // // Created by Administrator 阅读全文
posted @ 2021-07-25 18:12 蘑菇王国大聪明 阅读(55) 评论(0) 推荐(0) 编辑
摘要:ColorCostDP.hpp // // Created by Administrator on 2021/7/21. // #ifndef C__TEST01_COLORCOSTDP_HPP #define C__TEST01_COLORCOSTDP_HPP #include <vector> 阅读全文
posted @ 2021-07-23 08:57 蘑菇王国大聪明 阅读(24) 评论(0) 推荐(0) 编辑
摘要:1.问题描述 给一个数组,0就是可以走,1就是有障碍, 只能往右往下走,问有几种路径走到右下角。 2.代码 // // Created by Administrator on 2021/7/21. // #ifndef C__TEST01_ROADDP_HPP #define C__TEST01_R 阅读全文
posted @ 2021-07-21 19:18 蘑菇王国大聪明 阅读(93) 评论(0) 推荐(0) 编辑
摘要:1. 问题描述 如果有三种硬币,2元,5元,7元,如何用最少的数量拼成27元? 2. 思路 (以后在更新吧) 3. 代码 // // Created by Administrator on 2021/7/20. // #ifndef C__TEST01_COINDP_HPP #define C__T 阅读全文
posted @ 2021-07-21 09:02 蘑菇王国大聪明 阅读(91) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示