摘要: 原题链接 题解 1.二分+dp code #include<bits/stdc++.h> using namespace std; string name[1000005],dp[1000005],st[1000005]; int main() { string s; cin>>s; int cnt 阅读全文
posted @ 2024-03-30 22:02 纯粹的 阅读(71) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.由于我刚刚才学字典树,所以我会告诉你这就类似字典树,对字符串终点节点加一,然后搜索统计最大前缀和 code #include<bits/stdc++.h> using namespace std; string s; int tree[2000005][65]={0}; int 阅读全文
posted @ 2024-03-30 20:37 纯粹的 阅读(28) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.建议去B站上看看动画演示,你就明白怎么回事了 2.如何用代码实现呢?看完你就明白了 code #include<bits/stdc++.h> using namespace std; int num=0; int tree[3000006][75]={0}; int cnt[30 阅读全文
posted @ 2024-03-30 20:20 纯粹的 阅读(102) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.如果数字为 \(100110101\) 那么答案为 \(000000000\) ~ \(011111111\) 中,k个1的组合数 + \(100000000\) ~ \(100011111\) 中k-1个1的组合数 +...+ \(1010101...\) (有k个1) 中0个 阅读全文
posted @ 2024-03-30 18:43 纯粹的 阅读(100) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.该题等价于构建一颗k叉树,每个叶子节点都有一个权值 \(leaf_i\) ,树的权值为 \(\sum_{1}^{n}leaf_i\) ,在使树的权值尽可能小的情况下,使最深的叶子节点的深度也尽可能小,即使数的高度尽可能小 这个叫做哈夫曼树 2.构建过程如下:每次从队列中取出 \( 阅读全文
posted @ 2024-03-30 11:47 纯粹的 阅读(62) 评论(0) 推荐(0)