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 ...
分类:
其他好文 时间:
2014-05-10 20:06:26
阅读次数:
404
Problem DescriptionGiven n integers.You have two
operations:U A B: replace the Ath number by B. (index counting from 0)Q A B:
output the length of the...
分类:
其他好文 时间:
2014-05-06 01:20:33
阅读次数:
332
typeof:typeof是一个一元运算符,放在一个运算数之前。"boolean"---如果这个值是布尔值。"string"---如果这个值是字符串。"number"---如果这个值是数值。"undefined"---如果这个值未定义。"object"---如果这个值是对象(包括Number,Str...
分类:
其他好文 时间:
2014-05-06 00:55:25
阅读次数:
698
Given a binary tree containing digits from 0-9
only, each root-to-leaf path could represent a number.An example is the
root-to-leaf path 1->2->3 which...
分类:
其他好文 时间:
2014-05-05 23:55:36
阅读次数:
407
题目:大意就是猜数,给定个四位数,然后给出这个数与正确的数之间的比较(#A*B,#代表有#个数字他的值和位置都对了,*代表有*个数的值对了),给出n个上述的4位数,让你确定这个正确的数是多少。
思路:直接暴力。
注意:程序结束是n为负数,而不是-1,为此超时了两次 T T。
代码:
#include
#include
#include
using namespace std;
str...
分类:
其他好文 时间:
2014-05-02 21:16:30
阅读次数:
314
原题链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1416
结论题,具体判断方法请点击这个网址。
筛素数是肯定的,但一开始定的范围太大了,想当然要筛到10^9的质数,但仔细想想,只要到sqrt(10^9)就可以了,最后的那一个质数是最...
分类:
其他好文 时间:
2014-05-02 13:41:45
阅读次数:
448
16、Power digit sum215= 32768 and the sum of its
digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number
21000?题目大意:215= 32768 并且其...
分类:
其他好文 时间:
2014-05-02 13:17:49
阅读次数:
1223
Okay for centos 6.4 also On apu.0xdata.loc,
after this install was done$ which python /usr/local/bin/python$ python -VPython
2.7.3$ ls -ltr /usr/local...
分类:
编程语言 时间:
2014-05-02 12:53:59
阅读次数:
609
链接:http://acm.hdu.edu.cn/showproblem.php?pid=3415
题意:给出一个数环,要找出其中9长度小于等于K的和最大的子段。
思路:不能采用最暴力的枚举,题目的数据量是10^5,O(N^2)的枚举回去超时,本题采用的很巧妙的DP做法,是用单调队列优化的DP。
运用的是STL的deque,从i:1~a找到以其中以i为尾的符合条件的子段,并将i本身放入双向队...
分类:
其他好文 时间:
2014-05-01 08:32:53
阅读次数:
324