摘要: #include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; struct Node { int id; int score; // 重载 < 运算符 // 规则:分数高的 阅读全文
posted @ 2026-03-21 16:22 9102700 阅读(4) 评论(0) 推荐(0)
摘要: #include <iostream> #include <string> using namespace std; void stringDemo() { string s = "algorithm"; // 1. 字符串拼接 s += " is fun"; // 2. 截取子串 (O(N) 复杂 阅读全文
posted @ 2026-03-21 16:20 9102700 阅读(7) 评论(0) 推荐(0)
摘要: #include <iostream> #include <set> using namespace std; void multisetDemo() { multiset<int> ms; // 1. 插入元素 ms.insert(5); ms.insert(3); ms.insert(5); / 阅读全文
posted @ 2026-03-21 15:53 9102700 阅读(5) 评论(0) 推荐(0)
摘要: 迭代器遍历 for (std::map<key_type, value_type>::iterator it = myMap.begin(); it != myMap.end(); ++it) { std::cout << it->first << " => " << it->second << s 阅读全文
posted @ 2026-03-08 21:50 9102700 阅读(3) 评论(0) 推荐(0)
摘要: 题目描述: 求运过去 \(n\) 头牛所需要的最少花费,所有牛均相同 方案为:运 1 头花费为 \(a[\ 1 \ ]\), 运 2 头为 \(a[\ 2 \ ]\)....... \(dp[i][j]\)需要定义为前 i 种方案,运 j 头牛,产生的最少花费 这里 \(dp[0][1-n]\) 均 阅读全文
posted @ 2026-01-27 16:33 9102700 阅读(4) 评论(0) 推荐(0)
摘要: 这是完全背包模板 一样东西可以使用无限次,那么,压缩成一维的 \(dp[j]\) 就不用再倒序避免重复使用 for(int i = 1; i <= n; i++){ for(int j = c[i]; j <= m; j++){ dp[j] = min(dp[j], dp[j - c[i]] + v 阅读全文
posted @ 2026-01-27 15:42 9102700 阅读(3) 评论(0) 推荐(0)
摘要: 这是二分优化的 LIS(严格上升)子序列 #define int long long int len[N]; int mylower(int x, int l, int r){ while(l < r){ int mid = (l + r + 1) >> 1; if(x > len[mid]){ l 阅读全文
posted @ 2026-01-05 17:42 9102700 阅读(6) 评论(0) 推荐(0)
摘要: 他说生活喜欢勇敢的人 阅读全文
posted @ 2024-10-06 21:30 9102700 阅读(41) 评论(0) 推荐(0)
摘要: 原始的力量也能做到曾经做不到的事情 阅读全文
posted @ 2024-09-22 16:08 9102700 阅读(27) 评论(0) 推荐(0)
摘要: A new life. 阅读全文
posted @ 2024-09-20 17:11 9102700 阅读(40) 评论(0) 推荐(0)