题目传送门:G - Scalene Triangle Area (atcoder.jp) 题意: 给定大小为N*N的OX矩阵,若矩阵的(s,t)处为O,其覆盖范围为:满足以下条件的所有位置(i,j) s <= i && t <= j (i - s) + (j - t) / 2 < M 再给出Q次询问,对于每次询问(x,y),要求给出对应位置被覆盖了多少次. 思路:imos 不妨先考虑 n = 7, m = 3, 且仅在左上角处为 'O' .那么矩阵上每个位置被覆盖次数如T…
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note: Your algorithm should run in linear runtime complexity. Could you implement it u…
转载:http://www.cnblogs.com/grandyang/p/4756677.html Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 3] return 2. Note:Your algorithm should run in li…
ACCEPTED CONFERENCE ON COMPUTER VISION AND PATTERN RECOGNITION 2001 Rapid Object Detection using a Boosted Cascade of Simple Features 简单特征的优化级联在快速目标检测中的应用 Paul Viola Michael Jones viola@merl.…
Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its sum is no larger than k. Example: Given matrix = [ [1, 0, 1], [0, -2, 3] ] k = 2 The answer is 2. Because the sum of rectangle [[0, 1], […
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead. Example 1: Given nums = [1, -1, 5, -2, 3], k = 3, return 4. (because the subarray [1, -1, 5, -2] sums to 3 and is th…
TSQL中的join语句共有五种类型,left join,right join,inner join,full join,cross join 为了描述方便,解释一个名词"保留表",在进行连接查询时,保留表中的数据行全部显示出来. 首先创建测试使用的代码 create table dbo.ta ( a int, b int ) create table dbo.tb ( ca int, cb int ) go insert into dbo.ta ,),(,) insert into…
group by是对检索结果的保留行进行单纯分组,一般总爱和聚合函数一块用例如AVG(),COUNT(),max(),main()等一块用. partition by虽然也具有分组功能,但同时也具有其他的功能. 它属于oracle的分析用函数. 借用一个勤快人的数据说明一下: sum() over (PARTITION BY ...) 是一个分析函数. 他执行的效果跟普通的sum ...group by ...不一样,它计算组中表达式的累积和,而不是简单的和.…