title:
The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence ...
分类:
其他好文 时间:
2014-06-05 12:03:29
阅读次数:
243
题目:
链接:点击打开链接
题意:
中文题
算法:
思路:
赤裸裸的最小生成树。。
代码:
#include
#include
using namespace std;
struct node{
int u,v,w;
} e[110];
int p[110];
int n,m,sum,ans;
int cmp(node...
分类:
其他好文 时间:
2014-06-05 03:50:23
阅读次数:
232
Given an array S of n integers, are there elements
a, b, c, and d in S such that a +
b + c + d = target?
Find all unique quadruplets in the array which gives the sum of target.
Note:
...
分类:
其他好文 时间:
2014-06-05 00:34:06
阅读次数:
240
当一道题目,使用__int64超时,使用int就能A的时候,我想,这个题,不是一个好题。。。。。
add[i]:记录加的lazy标记
mul[i]:记录乘的lazy标记
num[i]:记录数的lazy标记
sum[i][j]:第i段,j次方的和。
除去lazy标记的下放,这完全就是一道水的线段树的题目。。。
lazy标记如何下放呢?
1,首先查看num标记,如果存在,果断下放。
2...
分类:
其他好文 时间:
2014-06-04 21:41:27
阅读次数:
343
成员:周其范20112794
胡宝月20112827上课的时候老师布置了这个题目,初一看这个题目,我们讨论的时候就是在想,应该从第一个数开始,一个一个加,一直加到最后一个数,然后从第二个数开始,一个一个加,加到最后一个,以此类推,在比较的过程中,我们需要比较每加一次的数大小,把每比一次的数赋给sum...
分类:
其他好文 时间:
2014-06-03 09:53:07
阅读次数:
243
记录3个变量。
sum[i]:当前区间被覆盖2次及两次以上的面积。
num[i]:当前区间被覆盖1次及一次以上的面积。
cover[i]:覆盖的lazy标记。
对于每一个区间.
更新操作如下:
void push_up(int_now)
{
if(cover[rt]==0)
{
num[rt]=num[rt<<1]+num[rt<<1|1];
...
分类:
其他好文 时间:
2014-05-31 17:58:57
阅读次数:
296
逆序数的性质。1. 暴力解 1 #include 2 3 #define MAXNUM 5005 4
5 int a[MAXNUM]; 6 7 int main() { 8 int n; 9 int i, j, sum, min;10 11 while
(scanf(...
分类:
其他好文 时间:
2014-05-31 07:50:50
阅读次数:
170
DescriptionLet us consider sets of positive
integers less than or equal ton. Note that all elements of a set are different.
Also note that the order o...
分类:
其他好文 时间:
2014-05-31 05:12:49
阅读次数:
246
Given a binary tree and a sum, determine if the
tree has a root-to-leaf path such that adding up all the values along the path
equals the given sum.Fo...
分类:
其他好文 时间:
2014-05-30 15:18:35
阅读次数:
246
Given a triangle, find the minimum path sum
from top to bottom. Each step you may move to adjacent numbers on the row
below.For example, given the fol...
分类:
其他好文 时间:
2014-05-30 14:59:37
阅读次数:
241