Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:
其他好文 时间:
2014-07-23 15:06:06
阅读次数:
320
Two passes: all pointer linking info will be recorded in 1st pass - to hashmap; 2nd pass recover the pointer relationship from hashmap.1A!class Soluti...
分类:
其他好文 时间:
2014-07-23 14:59:26
阅读次数:
209
不懂得详见poj 2356 抽屉原理详解,这题竟然卡精度。。。提交了好几次都WA,改成long long sum[100100] 才对
代码如下:
#include
#include
int flag[100100],a[100100],str[100100];
long long sum[100100];
int main()
{
int n,i,j,t,chi;
whi...
分类:
其他好文 时间:
2014-07-23 13:38:16
阅读次数:
228
地址:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3799
Two star-crossed lovers want to meet. The two lovers are standing at distinct points in t...
分类:
其他好文 时间:
2014-07-23 13:29:04
阅读次数:
242
贪心策略:因为2*难度(1~100) 远比500*时间 的影响小,所以说,先对时间从大到小排序,相等的再按照等级从大到小排序;对任务和机器都排序之后,再统计满足任务时间的机器,选择等级最接近任务难度的的机器;
因为数据很多,很可能超出int范围,要用长整型,但是最后输出的时候,如果用printf( "%lld %lld\n", sol, sum );输出的话,会发现第二个数会是0,在这上面wa了n次。。
最后问了一下学长,用了%I64,才正确,后来有自己百度了一下http://blog.csdn.net...
分类:
其他好文 时间:
2014-07-23 13:25:18
阅读次数:
297
//注意将价格转化为整数即可
# include
# include
# include
using namespace std;
int max(int a,int b)
{
return a>b?a:b;
}
int dp[3000050];
int main()
{
int n,i,j,flag,l,m;
int suma,sumb,sumc,sum;
double q,...
分类:
其他好文 时间:
2014-07-23 13:15:36
阅读次数:
177
Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 2 #include 3 using namespace std; 4 .....
分类:
其他好文 时间:
2014-07-23 12:27:06
阅读次数:
252
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2014-07-23 12:03:26
阅读次数:
287
题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 题解:....
分类:
编程语言 时间:
2014-07-23 12:01:36
阅读次数:
257
题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.http....
分类:
编程语言 时间:
2014-07-23 12:01:06
阅读次数:
330