#include //将读入的数据存储到num[1]~num[x]中,num[0]表示存入数据的长度。void read(int num[]){ int i; char ch; for (i = 0; i b[0]) sum[0] = a[0]; else ...
分类:
其他好文 时间:
2014-07-09 18:37:12
阅读次数:
232
Write code to partition a linked list around a value x, such that all nodes less than x come before all nodes greater than or equal to x.Use two addit...
分类:
其他好文 时间:
2014-07-09 17:44:36
阅读次数:
159
3SumGiven an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:El...
分类:
其他好文 时间:
2014-07-09 15:48:57
阅读次数:
223
You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the Ts d...
分类:
其他好文 时间:
2014-07-09 15:35:19
阅读次数:
176
一。介绍 聚合函数如SUM, COUNT, MAX, AVG等。这些函数和其它函数的根本区别就是它们一般作用在多条记录上。而通过使用GROUP BY子句,可以让SUM 和 COUNT 这些函数对属于一组的数据起作用。当你指定 GROUP BY region 时,只有属于同一个region的一组...
分类:
数据库 时间:
2014-07-09 15:13:19
阅读次数:
217
When you use an arithmetic operator, the operands go through two conversions.Integer promotions: If int can represent all values of the type, then the...
分类:
编程语言 时间:
2014-07-09 13:46:00
阅读次数:
278
本文将介绍Java如何实现对存数过程的调用方法,作者用了几个例子进行了详细的说明,简单明了,非常适合初学者。
一、Java如何实现对存储过程的调用:
A:不带输出参数的
create procedure getsum @n int =0--此处为参数--> as declare @sum int--定义变量--> declare @i int...
分类:
编程语言 时间:
2014-07-09 12:42:38
阅读次数:
270
模板
题意:给你一个图,1总是为根,每个边有单位价值,每个点有权重。
每条边的价值 = sum(后继节点权重)*边的单位价值。
求树的最小价值,即构成一棵树的n-1条边的最小价值。
算法:
1、因为每个边的价值都要乘以后来访问的节点的权重,而走到后来访问的点必经过这条边。
实际上总价值就是 到每个点的最短路径*这个点的权重。
2、但是这个题 数据量真的太大了,50000个点...
分类:
其他好文 时间:
2014-07-09 11:33:57
阅读次数:
273
LCA tarjan 的离线算法
#include
#include
#include
using namespace std;
const int maxn = 40010;
int first[maxn], head[maxn], cnt, sum;
struct edge
{
int u, v, w, next;
}e[maxn*2], qe[maxn], Q[maxn];
int...
分类:
其他好文 时间:
2014-07-09 10:23:35
阅读次数:
256
题目要求任选几个自然数,使得他们的和是n的倍数。
由鸽巢原理如果我们只选连续的数,一定能得到解。
首先预处理前缀和模n下的sum,如果发现sum[i]==sum[j] 那么(sum[j]-sum[i])%n一定为0,直接输出i+1~j就够了。
为什么一定会有解,因为sum从1~n有n个数,而模n下的数只有0~n-1,把n个数放入0~n-1个数里,怎么也会有重复,所以这种构造方法一定没问题。
...
分类:
其他好文 时间:
2014-07-08 10:47:19
阅读次数:
260