相关文章
HDU3555:Bomb
题目描述 The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current number sequence includes the sub-sequence "49", the powe…
建站知识
2025/2/20 15:56:57
HDU 3555 Bomb
越来越迷了。。。
数位DP
(HDU这几天怎么炸了。。。) 题目大意:给你一个数 x ,求从1到x中数字’49’一共出现了几次。简单数位DP,f[i][0/1]表示当前第 i <script type"math/tex" id"MathJax-Element-98">i<…
建站知识
2025/2/2 1:51:21
bzoj3555 hash
题意:给n个字符串,保证两两不重复。现在定义一对字符串如果仅只有1位不同,那么它视为相似字符串,问现在有多少对相似字符串。 思路:题目没给数据,其实可以O(lnlogn)暴力的。用hash爆力处理。 这次一开始用的…
建站知识
2025/2/2 2:06:47
AcWing 3555. 二叉树
倍增LCA算法 基本思想为先把两个结点调整到同一深度, 然后同时往上走, 直到两个结点相等。 要完成这些, 除了记录左右儿子, 还要记录父节点以及各结点深度
时间复杂度: 遍历树获取深度 O(n) 获取祖先 O(logn) 对于每个样例&#…
建站知识
2025/2/2 1:48:12