会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
butter-123
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
下一页
2024年6月5日
01背包c++
摘要: 思路看书去 #include <iostream> using namespace std; // 物品数量 #define N 4 // 背包大小 #define R 5 int value[N] = {2, 4, 4, 5}; int weigh[N] = {1, 2, 3, 4}; // #d
阅读全文
posted @ 2024-06-05 21:54 CV小能手chh
阅读(13)
评论(0)
推荐(0)
2024年5月30日
01背包回溯解法c++
摘要: #include <iostream> using namespace std; // 城市数量 #define N 4 //背包空间 #define R 5 int value[N] = {2, 4, 4, 5}; int weigh[N] = {1, 2, 3, 4}; // #define N
阅读全文
posted @ 2024-05-30 11:45 CV小能手chh
阅读(14)
评论(0)
推荐(0)
tsp回溯法递归解法c++
摘要: 思路看书 #include <iostream> using namespace std; // 城市数量 #define N 4 // 课本例题 int dis[N][N] = {{0, 3, 6, 7}, {5, 0, 2, 3}, {6, 4, 0, 2}, {3, 7, 5, 0}}; //
阅读全文
posted @ 2024-05-30 11:38 CV小能手chh
阅读(10)
评论(0)
推荐(0)
tsp动态规划非递归写法c++
摘要: 看注释 #include <iostream> #include <cstdlib> #include <ctime> #include <iomanip> using namespace std; #define N 4 #define MAX 0x3f3f3f3f int dp[N][1 <<
阅读全文
posted @ 2024-05-30 11:31 CV小能手chh
阅读(7)
评论(0)
推荐(0)
tsp动态规划递归解法c++
摘要: 这里使用二进制位表示城市集合,思路看书去吧 #include <iostream> #include <cstdlib> #include <ctime> #include <iomanip> #include <bitset> using namespace std; #define N 4//矩
阅读全文
posted @ 2024-05-30 11:18 CV小能手chh
阅读(11)
评论(0)
推荐(0)
2024年5月28日
素数环_回溯法
摘要: 课本例题: 素数环是一个计算机程序问题,指的是将从1到n这n个整数围成一个圆环,若其中任意2个相邻的数字相加,结果均为素数,那么这个环就成为素数环。 #include <iostream> #include <cmath> using namespace std; int Prime(int x)
阅读全文
posted @ 2024-05-28 21:52 CV小能手chh
阅读(15)
评论(0)
推荐(0)
2024年5月24日
力扣3152. 特殊数组 II
摘要: 如果数组的每一对相邻元素都是两个奇偶性不同的数字,则该数组被认为是一个 特殊数组 。 周洋哥有一个整数数组 nums 和一个二维整数矩阵 queries,对于 queries[i] = [fromi, toi],请你帮助周洋哥检查子数组 nums[fromi..toi] 是不是一个 特殊数组 。 返
阅读全文
posted @ 2024-05-24 12:58 CV小能手chh
阅读(21)
评论(0)
推荐(0)
2024年5月11日
动态规划:力扣LCR 188. 买卖芯片的最佳时机
摘要: 题目 数组 prices 记录了某芯片近期的交易价格,其中 prices[i] 表示的 i 天该芯片的价格。你只能选择 某一天 买入芯片,并选择在 未来的某一个不同的日子 卖出该芯片。请设计一个算法计算并返回你从这笔交易中能获取的最大利润。 如果你不能获取任何利润,返回 0。 示例 1: 输入:pr
阅读全文
posted @ 2024-05-11 11:56 CV小能手chh
阅读(10)
评论(0)
推荐(0)
2024年4月16日
c++学习笔记3,继承
摘要: 一个类可以继承一个或多个类,这个类叫派生类,被继承的叫基类 class A{ }; class B{ }; class C{ }; class myclass :private A,protect B,public C//继承方式 类,多继承时之间用逗号间隔 { } 继承方式决定对基类成员的访问权限
阅读全文
posted @ 2024-04-16 17:26 CV小能手chh
阅读(8)
评论(0)
推荐(0)
2024年4月13日
c++学习笔记2,类
摘要: 类的定义 class 类名:myclass{ myclass();//构造函数 ~myclass();//析构函数 myclass(mycalss &a);//拷贝构造函数 privat://缺省为私有 //私有变量和函数 public: //公有变量和函数 protect: //受保护的变量和函数
阅读全文
posted @ 2024-04-13 18:53 CV小能手chh
阅读(28)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
下一页
公告