因为实验室项目好久没刷题了。从今天开始重新开始刷题。 Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers...
分类:
其他好文 时间:
2014-07-16 23:04:15
阅读次数:
166
Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,...
分类:
编程语言 时间:
2014-07-12 12:56:52
阅读次数:
206
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-07-12 00:15:07
阅读次数:
268
Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sum...
分类:
其他好文 时间:
2014-07-11 08:41:13
阅读次数:
156
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is [1, 2, 3...
分类:
其他好文 时间:
2014-07-11 00:51:05
阅读次数:
195
Description
Magic Numbers
Write a program that finds and displays all pairs ofintegers and
such that:
neither nor
have any digits repeated; and , where
N is a given i...
分类:
其他好文 时间:
2014-07-10 20:10:06
阅读次数:
238
大多数人的写法是进行位压缩,不过那样的话需要2^18*100 的空间,效率比较低,重复状态数较多,处理起来也不方便,这一题是给出了512M的空间。但是如果空间再小一倍,前者的方法就无能为力了。
发现有一种对于数位dp来说比较好的状态压缩方式,直接根据数码x出现的次数进行状态压缩。比如说333444,如果用前者的方法压缩就需要2^6=64的空间,而直接按照出现次数压缩就只需要3*3的空间,对于极限数据,利用均值不等式,也差不多只需(ceil(18/10+1)^10)=59049的空间,提高了空间的利用率(原来...
分类:
其他好文 时间:
2014-07-10 19:35:18
阅读次数:
213
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
杭电服务器是慢啊。。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define ll long long
#define N 1000005
sets;
ll ans[1783]={
126,153,688,1206,1255,1260,...
分类:
其他好文 时间:
2014-07-08 18:58:12
阅读次数:
252
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 1’s ...
分类:
其他好文 时间:
2014-07-08 13:34:40
阅读次数:
195