Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3...
分类:
其他好文 时间:
2015-04-09 21:57:21
阅读次数:
131
题目大意:
校门外栽满了不同高度的树,每一次询问是 如果砍掉所有高度不超过q的树,那么还有多少个连续的块。
思路分析:
记录左连续和 右连续和 用来维护区间的连续块的数量。
即
seg[num] = seg[num
如果中间部分连起来 那么减一即可。
#include
#include
#include
#include
#define maxn 50...
分类:
其他好文 时间:
2015-04-09 21:56:21
阅读次数:
160
UIPageControl继承了UIControl基类,默认属于活动控件,它可以与用户进行交互,经常与UIScrollerView结合使用,在实际项目也是经常使用的。当把UIScrollView的pagingEnabled设置为YES之后,UIScrollView至少每次滚动一页。此时通常结合UIPageControl使用,UIPageControl控件会充当两个功能。
使用UIPageCon...
分类:
其他好文 时间:
2015-04-09 21:58:11
阅读次数:
153
from math import log
#以决策为标准计算信息熵
def calcShannonEnt(dataSet):
numEntries = len(dataSet)
labelCounts = {}
for featVec in dataSet:
currentLabel = featVec[-1]
if cu...
分类:
其他好文 时间:
2015-04-09 21:56:49
阅读次数:
265
关键词:
no-lock interlocked lock-free tcp/ip server engine iocp server out-of-orderexecution
无锁 原子锁 原子操作 原子指令 锁无关 开放锁 通讯服务器 引擎 高并发 大数据 搜索引擎 完成端口服务器 cpu乱序并行执行 内存栅栏
IOKING MsgEngine无锁消息引擎(no-loc...
分类:
其他好文 时间:
2015-04-09 21:56:40
阅读次数:
205
//101010101
//000000000
//101010101
//000000000
//101010101
//000000000
//101010101
//000000000
//101010101
//当m , n在1时,是zz赢
//因为起点在1点时,kiki走一步肯定是走到0处,而zz一定又能走到1
//故左下角的1肯定是zz走到
//如果m,n在0,...
分类:
其他好文 时间:
2015-04-09 21:56:45
阅读次数:
124
看了斌神的题解恍然大悟http://www.kuangbin.net/archives/bc36
代码:
#include
#include
#include
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int N = 200005;
int t, n, m, f[N], r...
分类:
其他好文 时间:
2015-04-09 21:58:18
阅读次数:
161
裸的半平面交求多边形是否有核.
多边形的核: 在多边形核上的点可以看到多边形的所有顶点,凸多边形的核显然就是多边形本身.
多边形的核是一个凸包,对多边形的所有边都做向着多边形的半平面交在判断一下是否构成凸包就可以了
一样的题目还有POJ3335
Video Surveillance
Time Limit: 1000MS
Memory...
分类:
其他好文 时间:
2015-04-09 21:55:32
阅读次数:
149
思路:
本题目要实现的效果就是产生一系列广义有序的字符串序列,本来想假如知道digits字符串长度的话,可以搞一个n层循环,但是digits的长度是未知的。想了好久,想到了用递归来实现本题目要实现的功能,每个数字循环到数字所代表字符的个数大小时,返回上一级递归,然后再在上一级的循环层次计数上再加1即可。
当字符的长度等于digits的长度时,说明已经产生一组有效的字符串,存储起来,然后将最后一个字符删除,继续循环。。。。
最后,当index<0时,说明整个循环已经结束,over!但是在具体实现的过程中,递...
分类:
其他好文 时间:
2015-04-09 21:55:57
阅读次数:
130
Description
It's Halloween! Farmer John is taking the cows to a costume party, but unfortunately he only has one costume. The costume fits precisely two cows with a length of S (1 ≤ S ≤ 1,000,000)....
分类:
其他好文 时间:
2015-04-09 21:56:32
阅读次数:
141
#include
#include
#include
using namespace std ;
int main()
{
int n , m;
while(~scanf("%d%d",&m , &n))
{
if((n >= m))
for(int i = m;i
printf("%d%c" , i ...
分类:
其他好文 时间:
2015-04-09 21:56:49
阅读次数:
106
题目链接:点击打开链接
题意:给定区间[l, r] 询问区间内有多少个数和n互质
思路:
solve(x) 表示[1,x]区间内与n互质的个数,则ans = solve(r)-solve(l-1);
与n互质的个数=所有数-与n不互质的数=所有数-(与n有一个因子-与n有2个因子的+与n有3个因子的)
状压n的因子个数,然后根据上面的公式容斥得到。
#include
...
分类:
其他好文 时间:
2015-04-09 21:53:32
阅读次数:
146
题目链接:点击打开链接
解题思路:
明显要消除连续的m才能使收益最大,我们直接暴力的枚举好了,每个区间的a[i + m ] - a[ i - 1] - 1的最大值即所求。这里在左右边界分别添上0和100
完整代码:
#include
#include
#include
#include
#include
using namespace std;
int n , m...
分类:
其他好文 时间:
2015-04-09 21:54:07
阅读次数:
125
Description
Farmer John recently bought a bookshelf for cow library, but the shelf is getting filled up quite quickly, and now the only available space is at the top.
Each of the N cows (1 ≤ N ≤ 20,...
分类:
其他好文 时间:
2015-04-09 21:54:52
阅读次数:
153
概述
个人知识管理一直是个比较重要的东西,总不会一个个txt文件乱堆一块吧。
本文将从以下几个方面介绍:
读书笔记管理PDF资料管理技术博文管理个人写作管理
读书笔记管理
Zim
读书笔记管理,我采用Zim。
这个桌面维基软件。最开始认识它是在linux下。其实它是一个跨平台的。支持window,linux,mac os
功能:
支持层次笔记自动生成笔记索引...
分类:
其他好文 时间:
2015-04-09 21:52:56
阅读次数:
122
常常被告诫,没有实例化的对象不能调用其成员方法。真的对吗?答案肯定不是。
其实钻一钻编译运行机制的空子是可以到的。
你执行一下下面的代码看看,是不是输出了“help”
class MyClass{
public:
int data;
MyClass(){
}
void print(){
cout<<"help"<<endl;...
分类:
其他好文 时间:
2015-04-09 21:53:24
阅读次数:
93
本节研究地址对齐的相关问题;...
分类:
其他好文 时间:
2015-04-09 21:53:52
阅读次数:
165