Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? InputThe first line of input contains N, the number ...
                            
                            
                                分类:
其他好文   时间:
2020-07-27 09:42:59   
                                阅读次数:
80
                             
                    
                        
                            
                            
                                    题意 给你两个长度为 \(n\) 的串 \(a,b\) 求 \(a,b\) 两序列各任取一数相加形成的$n^2$个和的异或和 $1 \le n \le 2 \times 10^5$ $0 \le a_i \le 2^{28}$ 传送门 思路 按位考虑。对于第$i$位,令 \(x=2^i\),所有数对 ...
                            
                            
                                分类:
其他好文   时间:
2020-07-26 22:51:31   
                                阅读次数:
66
                             
                    
                        
                            
                            
                                    题目链接 https://leetcode-cn.com/problems/merge-two-binary-trees/ 题解 递归解法 解法见代码注释 // Problem: LeetCode 617 // URL: https://leetcode-cn.com/problems/merge- ...
                            
                            
                                分类:
其他好文   时间:
2020-07-26 01:03:49   
                                阅读次数:
54
                             
                    
                        
                            
                            
                                    ##题面 he length of the longest common prefix of two strings s=s1s2…sn and t=t1t2…tm is defined as the maximum integer k (0≤k≤min(n,m)) such that s1s2…s ...
                            
                            
                                分类:
其他好文   时间:
2020-07-26 00:15:56   
                                阅读次数:
106
                             
                    
                        
                            
                            
                                题目大意: 给出个点,n为偶数,询问两个完全没有交集的匹配q和p。 一方面使得n个点两两互相匹配,一方面使得匹配的权值和最小 分析: 因为n是偶数,所以可以考虑将n个数分配到不同的长度为偶数的环中,对于排列q和排列p,只需要在偶环中交换一下位置就好。 但这个偶环的长度必须要大于2,因为如果长度为2, ...
                            
                            
                                分类:
其他好文   时间:
2020-07-24 21:58:55   
                                阅读次数:
72
                             
                    
                        
                            
                            
                                >>>dict() # 创建空字典 {} >>> dict(a='a', b='b', t='t') # 传入关键字 {'a': 'a', 'b': 'b', 't': 't'} >>> dict(zip(['one', 'two', 'three'], [1, 2, 3])) # 映射函数方式来构 ...
                            
                            
                                分类:
其他好文   时间:
2020-07-24 19:10:00   
                                阅读次数:
67
                             
                    
                        
                            
                            
                                    pip安装 pip install pytest-html 编写脚本 import pytest class TestClass(object): def test_one(self): x = "this" assert 'h' in x def test_two(self): x = "hell ...
                            
                            
                                分类:
其他好文   时间:
2020-07-23 16:50:29   
                                阅读次数:
121
                             
                    
                        
                            
                            
                                    在c++中检查字符串是否包含另一串字符串,这个本来是我做过的一个算法题,不过最近刚好有个需求让我想到了这个题,就在此记录一下! 使用std::string::findfunction string str ("There are two needles in this haystack."); st ...
                            
                            
                                分类:
编程语言   时间:
2020-07-22 02:02:45   
                                阅读次数:
79
                             
                    
                        
                            
                            
                                    对于这道题,可以想想对于每个b[i],a[i]中可选的位置的区间在哪,这样只要找到区间,就能知道当前可以选那几个位置断开 b[1]的开头肯定是1号位,而我们发现如果对后缀求一下后缀的最小值,这样就天然满足题目条件,我们用一个map存一下答案,就能知道b[i]是最小值的区间是哪些 因为b是单调递增的数 ...
                            
                            
                                分类:
其他好文   时间:
2020-07-22 02:00:03   
                                阅读次数:
62
                             
                    
                        
                            
                            
                                    在gradle中,如果多个子项目使用目录进行分组,可以使用如下方法 // include two projects, 'foo' and 'foo:bar' // directories are inferred by replacing ':' with '/' include 'foo:bar' ...
                            
                            
                                分类:
其他好文   时间:
2020-07-21 22:45:12   
                                阅读次数:
108