题目链接:hdu_5314_Happy King 题意: 给出一颗n个结点的树,点上有权值; 求点对(x,y)满足x!=y且x到y的路径上最大值与最小值的差<=D; 题解: 还是树的点分治,在统计答案的时候先按到根的最小值排序,然后用最大值减D去找有多少个满足答案。 1 #include<bits/ ...
分类:
移动开发 时间:
2016-11-17 23:49:57
阅读次数:
199
A ~~ B ~~ C 对于第二种方法,我们可以任取一个换c[i]个potions,花费d[i];或者是不取,我的做法就是枚举这些情况,得到剩余的s,再尽量优的获取小的a[i]; 枚举+二分 #include<bits/stdc++.h> using namespace std; #pragma c ...
分类:
其他好文 时间:
2016-11-17 00:56:06
阅读次数:
244
AM学军OJ T1 暴力 1 #include<bits/stdc++.h> 2 3 using namespace std; 4 5 typedef long long LL; 6 const int N = 2000000 + 10; 7 8 int len, power; 9 10 int g ...
分类:
其他好文 时间:
2016-11-15 23:41:21
阅读次数:
291
题意:http://www.lydsy.com/JudgeOnline/problem.php?id=1340 挺好的一道题... 有曲线不能从左下到右上等价于,不存在从左上到右下的曲线,满足曲线一直在圆内或矩形边界上 所以删除数量最小的圆,使得上下不连通即可 1 #include<bits/std ...
分类:
其他好文 时间:
2016-11-11 23:34:42
阅读次数:
276
1 #include <bits/stdc++.h> 2 #define ll long long 3 #define lson l, m, rt<<1 4 #define rson m+1, r, rt<<1|1 5 using namespace std; 6 const int N = 5e4 ...
分类:
其他好文 时间:
2016-11-10 23:48:34
阅读次数:
284
给出考试时间和考试需要准备的时间,问最早考完所有科目的时间 二分答案 NlogN 二分抄神犇的写法 感觉挺舒服的嘻嘻嘻 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int MAXN=1e5+5; 4 int N,M,d[MAXN] ...
分类:
其他好文 时间:
2016-11-10 14:12:12
阅读次数:
161
题目链接:https://uva.onlinejudge.org/external/103/10305.pdf 紫书P167 拓扑排序。 dfs——从一个点出发,dfs 与之相连的所有点,把本身放入到拓扑排序的首部。 #include <bits/stdc++.h> using namespace ...
分类:
编程语言 时间:
2016-11-09 22:47:41
阅读次数:
211
The metric system In some cases when used to describe data transfer rates bits/bytes are calculated as in the metric system as follows: 1 MB = 1,000,0 ...
分类:
其他好文 时间:
2016-11-09 19:49:44
阅读次数:
168
191. Number of 1 Bits Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). Fo ...
分类:
其他好文 时间:
2016-11-09 11:43:49
阅读次数:
205
190. Reverse Bits Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 0000001010010100000111 ...
分类:
其他好文 时间:
2016-11-09 11:38:35
阅读次数:
145