Loading

摘要: ![image](https://img2023.cnblogs.com/blog/3206340/202307/3206340-20230716153143998-106199013.png) 是道挺明显的换根dp,但是我还是不会orz 首先暴力的思路是容易想的,比如以0为根节点,然后做一遍dfs 阅读全文
posted @ 2023-07-16 15:37 烤肉kr 阅读(2) 评论(0) 推荐(0) 编辑
摘要: ![image](https://img2023.cnblogs.com/blog/3206340/202307/3206340-20230714210259828-1256777020.png) 借用灵神的图: ![image](https://img2023.cnblogs.com/blog/3 阅读全文
posted @ 2023-07-14 21:06 烤肉kr 阅读(1) 评论(0) 推荐(0) 编辑
摘要: ![image](https://img2023.cnblogs.com/blog/3206340/202307/3206340-20230711154226849-917547846.png) 一个玄学经验,涉及到`子序列`的题,通常都是用dp解,所以看到这题,我就直接用dp思路来入手了。 状态定 阅读全文
posted @ 2023-07-11 15:49 烤肉kr 阅读(4) 评论(0) 推荐(0) 编辑
摘要: ![image](https://img2023.cnblogs.com/blog/3206340/202307/3206340-20230710102113926-1534260915.png) # 排序+二分 可以先对数组排序,这样就拥有了单调性,就可以在其上做二分。 首先枚举第一个数a,然后枚 阅读全文
posted @ 2023-07-10 10:25 烤肉kr 阅读(32) 评论(0) 推荐(0) 编辑
摘要: ![image](https://img2023.cnblogs.com/blog/3206340/202307/3206340-20230708120939877-1024552120.png) 典中典,没啥好说的,主要练习一下Rust的二分查找API。 ```Rust impl Solution 阅读全文
posted @ 2023-07-08 12:10 烤肉kr 阅读(17) 评论(0) 推荐(0) 编辑
摘要: ![image](https://img2023.cnblogs.com/blog/3206340/202306/3206340-20230629163634202-1256632665.png) 考虑动态规划: + 状态设计:`f[i][2]`,其中`f[i][0]`表示以第i个数为结尾,并且没删 阅读全文
posted @ 2023-06-29 16:39 烤肉kr 阅读(3) 评论(0) 推荐(0) 编辑
摘要: ![image](https://img2023.cnblogs.com/blog/3206340/202306/3206340-20230629123946831-2057410577.png) 考虑贪心策略。每一列,把1优先放在lower和upper两行中较大的那一行上。 ```Rust imp 阅读全文
posted @ 2023-06-29 12:41 烤肉kr 阅读(3) 评论(0) 推荐(0) 编辑
摘要: ![image](https://img2023.cnblogs.com/blog/3206340/202306/3206340-20230625162358036-1384865233.png) 原问题可以转换为,判断圆心到矩形的最短距离是否小于等于半径。 ![image](https://img 阅读全文
posted @ 2023-06-25 16:32 烤肉kr 阅读(4) 评论(0) 推荐(0) 编辑
摘要: # 声明强化 在C++17之后,if语句可以像for循环语句一样,在括号里声明一个变量了。 ```cpp if (int x = 5; x data; Test(std::initializer_list list) { for (auto itr = list.begin(); itr != li 阅读全文
posted @ 2023-06-24 22:21 烤肉kr 阅读(5) 评论(0) 推荐(0) 编辑
摘要: # 简介 `constexpr`是C++11引入的关键字。它的意思是常量表达式,但是与之前的常量`const`不同,`constexpr`会在编译期就计算完该值,从而提高了性能。同时`constexpr`也可以用来修饰函数、类的构造函数等,不止是变量。 # 适用于`constexpr`的类型 根据微 阅读全文
posted @ 2023-06-23 14:43 烤肉kr 阅读(448) 评论(0) 推荐(0) 编辑