传送门 首先 $n=\sum_{i=1}^{ans}(2^{x_{ans}}+p)$ 可以变成 $n-ans \cdot p=\sum_{i=1}^{ans}2^{x_{ans}}$ 注意到如果 $n-ans \cdot p$ 二进制下 $1$ 的个数等于 $ans$ ,那么一定有解 (只要把 $x ...
分类:
其他好文 时间:
2019-10-27 18:51:22
阅读次数:
82
235. Lowest Common Ancestor of a Binary Search Tree Easy Easy Easy Given a binary search tree (BST), find the lowest common ancestor (LCA) of two give ...
分类:
其他好文 时间:
2019-10-27 18:33:31
阅读次数:
62
#include<iostream> #include<cstdio> #define maxn 100005 using namespace std; struct node{ int l,r,sum,lazy; }tree[maxn<<2]; void pushUp(int root){ tre ...
分类:
编程语言 时间:
2019-10-27 18:16:26
阅读次数:
99
以下是网上流传比较广泛的30种SQL查询语句优化方法: 应尽量避免在 子句中使用!=或操作符,否则将引擎放弃使用索引而进行全表扫描。 对查询进行优化,应尽量避免全表扫描,首先应考虑在 及 order by 涉及的列上建立索引。 应尽量避免在 子句中对字段进行 值判断,否则将导致引擎放弃使用索引而进行 ...
分类:
数据库 时间:
2019-10-27 17:06:05
阅读次数:
95
传送门:https://codeforces.com/contest/1247/problem/C 题意::给你一个 n 和 p,有这样的一种二级制 “p-binary” ( 2^x+p , x非负 ); 要你用最少数量的 “p-binary”之和表示 n;无法构成输出-1; 数据大小: 1<=n< ...
分类:
其他好文 时间:
2019-10-27 17:02:18
阅读次数:
62
公司接口自动化,需要用到cookie。这个cookie可以从login的响应header中取到。 直接用python调这个接口,返回的响应header是这个: 没有看到预期的数据。 刚好公司Jmeter已经有现成的调用,看了下View Results Tree: 懵!为啥请求了5次。就在花了大半天时 ...
分类:
其他好文 时间:
2019-10-27 16:36:05
阅读次数:
78
Difficulty:easy More:【目录】LeetCode Java实现 Description https://leetcode.com/problems/maximum-depth-of-binary-tree/ Given a binary tree, find its maximum ...
分类:
其他好文 时间:
2019-10-27 11:10:58
阅读次数:
69
传送门 "Luogu" 解题思路 线段树合并板子题(也可以 dsu on the tree) 好像没什么好讲的,就是要注意开 long long 。 细节注意事项 + 咕咕咕 参考代码 cpp include include include include include include inclu ...
分类:
其他好文 时间:
2019-10-27 11:05:39
阅读次数:
83
传送门 "Luogu" 解题思路 考虑把22个字符状压下来,易知合法情况就是状态中之多有一个1,这个可以暴力一点判断23次。 然后后就是 dsu on the tree 了。 细节注意事项 + 咕咕咕 参考代码 cpp include include include include include ...
分类:
其他好文 时间:
2019-10-27 10:52:03
阅读次数:
57
传送门 "Luogu" 解题思路 整体二分。 的确是很难看出来,但是你可以发现输出的答案都是一些可以被看作是关键字处于 $[1, n]$ 的询问,而答案的范围又很显然是 $[0, n]$,这不就刚好满足了整体二分的几个组成部分了吗。 那么我们要如何求出 $mid$ 位置的解呢? 考虑 $\text{ ...
分类:
其他好文 时间:
2019-10-27 10:23:53
阅读次数:
113