\(\text{Problem}:\)Three strings \(\text{Solution}:\) 仿照 \(\text{SA}\) 连接多个串的方式,我们可以把这三个串连成:\(A+\)#\(+B+\)?\(+C\) 的形式。那么 \(A,B,C\) 中相同的子串在 \(\text{SAM ...
分类:
其他好文 时间:
2021-03-30 13:18:03
阅读次数:
0
We can rotate digits by 180 degrees to form new digits. When 0, 1, 6, 8, 9 are rotated 180 degrees, they become 0, 1, 9, 8, 6 respectively. When 2, 3, ...
分类:
其他好文 时间:
2021-03-30 12:50:16
阅读次数:
0
题面 https://www.luogu.com.cn/problem/P6622 分析 枚举每个信号塔的位置显然不行,考虑设置 DP 状态 f[S] 表示选择了集合为 S 的塔,排在前 |S| 个位置 方程则为 $f[S|i]=f[S]+h[S,i]$ $h[S,i]$ 表示 S 中与 i 有连边 ...
分类:
其他好文 时间:
2021-03-29 12:31:50
阅读次数:
0
思路:双指针从后往前遍历,根据第一个遇到的空格划分单词,使用StringBuilder拼接。 贴一下从后往前最后一个单词怎么拼接: 1.如果首位为字母,while(i >= 0 && s.charAt(i) != ' '),i为-1时进行拼接然后跳出大循环。 2.如果首位为空格,也类似,只是不用拼接 ...
分类:
其他好文 时间:
2021-03-29 12:24:40
阅读次数:
0
ES:1:倒排索引 基于Document 关键词索引实现 、 根据关键词做索引 相关度 a. 数据结构 i. 包含关键词的Document List ii. 关键词在每个doc中出现的次数 词频 TF term frequency iii. 关键词在整个索引中出现的次数 IDF inverse do ...
分类:
其他好文 时间:
2021-03-29 12:21:55
阅读次数:
0
题目链接 https://codeforces.com/contest/1506/problem/A 原题 1506A - Strange Table Example input 5 1 1 1 2 2 3 3 5 11 100 100 7312 1000000 1000000 1000000000 ...
分类:
其他好文 时间:
2021-03-29 11:53:53
阅读次数:
0
Problem A - Determinant 按题意来进行直接计算 时间复杂度:\(\mathcal{O}(1)\) int main() { ios_base::sync_with_stdio(false), cin.tie(0); int a, b, c, d; cin >> a >> b > ...
分类:
其他好文 时间:
2021-03-29 11:52:31
阅读次数:
0
问题 给定不同面额的硬币和一个总金额。写出函数来计算可以凑成总金额的硬币组合数。假设每一种面额的硬币有无限个。 示例 输入: amount = 5, coins = [1, 2, 5] 输出: 4 解释: 有四种方式可以凑成总金额: 5=5 5=2+2+1 5=2+1+1+1 5=1+1+1+1+1 ...
分类:
其他好文 时间:
2021-03-26 15:29:36
阅读次数:
0
题目链接:http://poj.org/problem?id=2255 递归经典习题。具体见代码: #include <iostream> #include <cstring> using namespace std; char a[111], b[111]; void dfs(int L1, in ...
分类:
其他好文 时间:
2021-03-18 14:30:29
阅读次数:
0
【python】Leetcode每日一题-螺旋矩阵2 【题目描述】 给你一个正整数 n ,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的 n x n 正方形矩阵 matrix 。 示例1: 输入:n = 3 输出:[[1,2,3],[8,9,4],[7,6,5]] 示例2: 输入 ...
分类:
编程语言 时间:
2021-03-17 14:59:30
阅读次数:
0