Given a sequence of integers S = {S1,S2,...,Sn}, you should determine what is the value of the maximum positive product involving consecutive terms...
分类:
其他好文 时间:
2015-08-02 21:21:49
阅读次数:
125
原题:Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the maximum positive product involving consecutive...
分类:
其他好文 时间:
2015-08-02 19:59:19
阅读次数:
100
题意简概:输入n个元素组成的序列S,你需要找一个乘积最大的连续子序列。如果这个最大的乘积不是正数,应输出0,表示无解。1 2 #include 3 using namespace std; 4 int a[18]; 5 6 int main() 7 { 8 int n,x=0; 9 ...
分类:
其他好文 时间:
2015-08-02 16:31:35
阅读次数:
105
//1 a b 将a位置的数改为b
//0 a b 输出[a,b] 区间内的 maximum sum of beautiful subsequence
//A beautiful subsequence is a subsequence that all the adjacent pairs
//of elves in the sequence have a different parity of...
分类:
其他好文 时间:
2015-08-02 15:13:38
阅读次数:
141
整数数据类型 C语言中不同字长的机器和编译器会分配不同字节大小.long类型是唯一与机器相关的. 32位机器上C语言的整数数据类型的典型取值范围负数的取值范围比正数大1 C data type Minimum Maximum char ?128 127 unsigned char 0 255 sho...
分类:
其他好文 时间:
2015-08-02 13:09:52
阅读次数:
129
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:
其他好文 时间:
2015-08-02 13:09:31
阅读次数:
106
https://leetcode.com/problems/maximum-subarray/Find the contiguous subarray within an array (containing at least one number) which has the largest sum...
分类:
其他好文 时间:
2015-08-02 11:43:32
阅读次数:
95
这题是典型的堆排序算法,只是比一般的堆算法多了删除的操作,有两件事需要做:1 用一个hash表存储从输入数组索引到堆数组(用于实现堆的那个数组)所以的映射,以便在需要删除一个元素的时候能迅速定位到堆数组中的位置2用一个set保存已经被删除的元素索引(这里指的是输入数组索引),这一点可选;还有一种做法...
很有趣的一道题,题解戳这。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 200000 + 10; 8 const int maxm = 1000000 + 1...
分类:
其他好文 时间:
2015-08-02 10:03:44
阅读次数:
123
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
思路:很基础的一个题,DFS即可。代码如下:
/**
* Defin...
分类:
其他好文 时间:
2015-08-01 22:08:25
阅读次数:
140