会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
白墨阁
远方盛大。
首页
新随笔
联系
管理
上一页
1
2
3
4
5
6
···
20
下一页
2025年9月6日
【分数类】
摘要: 【分数类】 struct Fraction { private: i64 numerator; // 分子 i64 denominator; // 分母 // 化简分数 void reduce() { if (denominator == 0) { throw invalid_argument("分
阅读全文
posted @ 2025-09-06 23:00 White_ink
阅读(6)
评论(0)
推荐(0)
2025年9月5日
【贪心结论】
摘要: 【贪心结论】 排序 Stacking of Goods https://codeforces.com/gym/105358/problem/J 【结论】交叉相乘 计算 \[c_1 \times 0 + c_2 \times w_1 + c_3 \times (w_1+w_2) + c_4 \time
阅读全文
posted @ 2025-09-05 15:40 White_ink
阅读(7)
评论(0)
推荐(0)
2025年8月29日
【交互题】
摘要: 【交互题】 输入 的数据是 根据输出的数据决定 的 语法格式 【推荐使用】若使用scanf printf: 在每次输出后加一句fflush(stdout) 若使用cin cout: 在#define endl '\n'的情况下 不要关闭同步流! 在每次输出后加一句fflush(stdout) 常见方
阅读全文
posted @ 2025-08-29 11:54 White_ink
阅读(5)
评论(0)
推荐(0)
2025年8月26日
(图论进阶笔记)【连通性】
摘要: 【连通性】 图的基本概念 图论基本定理 对于任何无向图\(G = (V, E)\),有\(\sum_{v \in V} d(v) = 2|E|\)(度数为边数的两倍)。 推论:在任意图中,度数为奇数的点必然有偶数个。 连通分量:无向图 对于一个不连通的无向图,它会被分割成多个极大连通子图,每个这样的
阅读全文
posted @ 2025-08-26 21:29 White_ink
阅读(11)
评论(0)
推荐(0)
【lowbit】
摘要: 【lowbit】 概念 \(lowbit(x)\):x的二进制表达式中 最低位的1 所对应的值 【性质】 可以整除n的最大2的幂次\(2^{i}\) i64 lowbit(i64 x){ return (x&-x); } 常见运用:统计二进制下1的个数 while(x){ x-=x&-x; ans+
阅读全文
posted @ 2025-08-26 19:23 White_ink
阅读(5)
评论(0)
推荐(0)
【哈希】
摘要: 【哈希】Hash 模版代码 字符串哈希 //双哈希 const int N = 1 << 21; static const i64 mod1 = 1E9 + 7, base1 = 127LL; static const i64 mod2 = 1E9 + 9, base2 = 131LL; using
阅读全文
posted @ 2025-08-26 10:08 White_ink
阅读(4)
评论(0)
推荐(0)
2025年8月20日
【翻硬币问题】
摘要: 【翻硬币问题】 Entangled Coins https://ac.nowcoder.com/acm/contest/108302/A 题目大意 思路 代码 const int N=3e5+10; i64 n,k,s,t; void solve(){ cin>>n>>k>>s>>t; if(n==
阅读全文
posted @ 2025-08-20 18:35 White_ink
阅读(4)
评论(0)
推荐(0)
2025年8月15日
【LCA】最近公共祖先
摘要: 【LCA】最近公共祖先 LCA(x,y) 模版代码 模版题 https://www.luogu.com.cn/problem/P3379 树上倍增 基础封装:针对无权图 把空间开到全局 struct Tree { int n; vector<vector<int>> ver, val; vector
阅读全文
posted @ 2025-08-15 15:04 White_ink
阅读(7)
评论(0)
推荐(0)
【C++魅力时刻】
摘要: 【C++魅力时刻】 记录一些因为语法问题不报RECE导致的WA 边界问题 本题n,m,a[i][j]范围 <=500 注意multiset特判if(son>min(n,m)) continue;否则count计数会比较奇怪 const int N=500; int n,m; multiset<int
阅读全文
posted @ 2025-08-15 11:24 White_ink
阅读(6)
评论(0)
推荐(0)
2025年8月12日
【链+环结构】
摘要: 【链+环结构】 有时题目造样例打表迭代完 会得到链+环的结构 链单独算 环统一算 最后环断链的单独算 幂中幂plus https://ac.nowcoder.com/acm/contest/113313/F 注意这题代码的简洁程度 思路 打表可以发现规律是一个链+环 直接模拟即可 注意快速幂不要爆l
阅读全文
posted @ 2025-08-12 21:58 White_ink
阅读(8)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
···
20
下一页
公告