Given an arraySofnintegers, are there
elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in
the array which gives the sum of ...
分类:
其他好文 时间:
2014-06-29 15:08:56
阅读次数:
263
1 #include 2 #include 3 using namespace std; 4
const int Max = 100000; 5 int num[Max]; 6 int find_[Max]; 7 bool found[Max]; 8
int pos[Max] = { 9 ...
分类:
其他好文 时间:
2014-06-07 03:49:29
阅读次数:
250
取出某一列不重复数据的ID表A有ID,BID,ITime三列BID可能会有重复的现在要从A表根据ITime降序排序取出ID来,且如果BID重复就只取第一条数据的ID应该如何实现?------解决方案--------------------如果id是递增的select
min(id),BID,max(...
分类:
数据库 时间:
2014-06-07 03:28:49
阅读次数:
324
Given two binary strings, return their sum
(also a binary string).For example,a ="11"b ="1"Return"100".class Solution
{public: string addBinary(str...
分类:
其他好文 时间:
2014-05-30 08:39:11
阅读次数:
270
mysql too many open
connections问题解决方法。原文参考:http://www.jbxue.com/db/10068.html原因主要是:max_connections配置问题导致,它必须在[mysqld]下面才会生效。曾经以为在my.cnf写入max_connectio...
分类:
数据库 时间:
2014-05-30 05:22:53
阅读次数:
319
先排序预处理,后01背包。 1 #include 2 #include 3 #include 4 5
#define MAX(a, b) (a>b) ? a:b 6 7 int dp[5000]; 8 9 typedef struct {10 int p,
q, v;11 } s...
分类:
其他好文 时间:
2014-05-29 11:40:04
阅读次数:
277
Given an arraySofnintegers, find three integers
inSsuch that the sum is closest to a given number, target. Return the sum of the
three integers. You m...
分类:
其他好文 时间:
2014-05-29 11:04:43
阅读次数:
200
//一个人从2000年1月1日开始三天打鱼两天晒网,用户输入一个日期,判断该人这天在打鱼还是晒网#include
void input();void sum(int y,int m,int d);int y,m,d;int main(void){
input(); sum(y,m,d); retu....
分类:
编程语言 时间:
2014-05-28 11:55:16
阅读次数:
289
题目:计算一棵二叉树所有路径组成的数的总和。思考:也是DFS的基础应用。虽然还是套着别人的DFS框架写的,但是学习通常会经历先模拟,再创新的过程。代码:
1 private int sum = 0; 2 public int sumNumbers(TreeNode root) { 3...
分类:
其他好文 时间:
2014-05-28 11:13:01
阅读次数:
225
函数实际上是对象,每个函数都是Function类型的实例。函数是引用类型。函数名实际上是一个执行函数对象的指针,不会与某个函数绑定。//
这种写法更能表达函数的本质var sum = function(num1, num2) { return num1 + num2;};var
another...
分类:
编程语言 时间:
2014-05-28 09:17:47
阅读次数:
454