• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

RomanLin

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

1 2 3 4 5 ··· 12 下一页

2026年7月2日

【设计模式与体系结构】行为型模式-模板方法模式

摘要: 简介 模板方法模式(Template Method Pattern)是一种行为型模式,其核心是在父类中定义好算法的流程,将流程中通用的部分直接在父类中实现,同时将一些特定的部分延迟到子类中实现。 模板方法模式的角色 抽象类:定义模板方法(通常定义为 final 方法,防止子类篡改流程)和基本操作的具 阅读全文

posted @ 2026-07-02 23:52 RomanLin 阅读(2) 评论(0) 推荐(0)

【区间最值线段树】Atcoder 408 F - Athletic

摘要: 题目 https://atcoder.jp/contests/abc408/tasks/abc408_f 题意 输入 \(n,d,r(1 \leq n \leq 5 \times 10^5, 1 \leq d \leq n,1 \leq r \leq n)\) 和一个大小为 \((n-1)\) 的排 阅读全文

posted @ 2026-07-02 19:58 RomanLin 阅读(1) 评论(0) 推荐(0)

2026年6月26日

【区间并集】Atcoder 457 E - Crossing Table Cloth

摘要: 题目 https://atcoder.jp/contests/abc457/tasks/abc457_e 题意 第一行输入两个正整数 \(n, m(1 \leq n \leq 2 \times 10^5, 2 \leq m \leq 2 \times 10^5)\); 接下来 \(m\) 行,每行输 阅读全文

posted @ 2026-06-26 01:00 RomanLin 阅读(3) 评论(0) 推荐(0)

2026年6月14日

【完全背包】LeetCode 1449. 数位成本和为目标值的最大数字

摘要: 题目 https://leetcode.cn/problems/form-largest-integer-with-digits-that-add-up-to-target/description/ 题解 因为每种面额的硬币能选的数量是没有限制的,因此这满足完全背包模型。 状态定义:定义一个大小为 阅读全文

posted @ 2026-06-14 17:38 RomanLin 阅读(3) 评论(0) 推荐(0)

2026年5月22日

【随机双模数哈希】LeetCode 3934. 最短唯一子数组

摘要: 题目 https://leetcode.cn/problems/smallest-unique-subarray/description/ 参考代码 struct Hash { static constexpr long long MOD1 = 1e9 + 7, MOD2 = 1e9 + 9; lo 阅读全文

posted @ 2026-05-22 00:48 RomanLin 阅读(5) 评论(0) 推荐(0)

2026年5月17日

【迪杰斯特拉】LeetCode 743. 网络延迟时间

摘要: 题目 https://leetcode.cn/problems/network-delay-time/description/ 题解 这是典型的单源最短路径模板题,思路是使用迪杰斯特拉算法算出从源点到所有点的最短路径的最大值,若存在无法抵达的目标点,则答案输出 \(-1\)。 参考代码 // 最短路 阅读全文

posted @ 2026-05-17 16:21 RomanLin 阅读(8) 评论(0) 推荐(0)

2026年4月28日

【单点修改,区间查询】洛谷 P3374 【模板】树状数组 1

摘要: 题目 https://www.luogu.com.cn/problem/P3374 参考代码 #include<bits/stdc++.h> typedef long long ll; template<typename E, typename F, typename F_INVERSE> clas 阅读全文

posted @ 2026-04-28 23:55 RomanLin 阅读(11) 评论(0) 推荐(0)

2026年4月20日

【种类并查集】洛谷 P2024 [NOI2001] 食物链

摘要: 题目 https://www.luogu.com.cn/problem/P2024 题解 种类并查集又称为扩展域并查集,是并查集的一种扩展形式,主要用于处理多组对立关系或多种状态划分的问题。在处理种类并查集问题时,有多少种类,就得开几倍的空间,用于表示所有的种类。 由题意,不妨假设现在有 \(n\) 阅读全文

posted @ 2026-04-20 00:43 RomanLin 阅读(10) 评论(0) 推荐(0)

2026年4月19日

【勾股定理】牛客周赛 Round 140 F. 小红的三角形构造

摘要: 题目 https://ac.nowcoder.com/acm/contest/132940/F 题解 构造勾股数的结论:奇数平方取一半,偶数半方加减一。 参考代码 #include<bits/stdc++.h> using namespace std; int main() { int T; cin 阅读全文

posted @ 2026-04-19 21:42 RomanLin 阅读(23) 评论(0) 推荐(0)

2026年4月14日

【第十七届蓝桥杯大赛】省赛 C/C++ B组 题解

摘要: A题 青春常数 #include<bits/stdc++.h> using namespace std; int main() { cout << 2026202520242023LL / 2LL + 1LL; return 0; } B题 双碳战略 #include<bits/stdc++.h> 阅读全文

posted @ 2026-04-14 23:15 RomanLin 阅读(143) 评论(0) 推荐(0)

1 2 3 4 5 ··· 12 下一页
 
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3