由买买提看人间百态

topics

全部话题 - 话题: localmax
(共0页)
z***2
发帖数: 66
1
来自主题: JobHunting版 - 问个题,火车运煤的DP解法
佩服!
import java.util.*;
class train {
public static void main(String[] args) {
double table[]=new double [10001];

table[0]=3000.0;

for(int i =1; i double localMax=-1.0;
double curDistance= i/10+ (double)(i%10)*1/10;
//System.out.println(curDistance);
for(int j=0; j
double totalLeft = table[j];
double prevDistance= j/10+ (double)(... 阅读全帖
a***e
发帖数: 413
2
我再看了看 http://www.cplusplus.com/reference/unordered_map/unordered_map/unordered_map/
请问你怎么知道那个map不用先判断是否里面有key对应的val,直接就像你那么写?int
curr=++map[key];(我是说你那么写是对的,但我不知道哪里能找到可以那么用的说
明?)
key=0L;key+=x;key<<=32;key+=y;
//find x,then y;
int curr=++map[key];
localmax=max(curr,localmax);
不用先判断key是否存在,像下面myMap这样
int hor = points[j].x - points[i].x;
int ver = points[j].y - points[i].y;
... 阅读全帖
b****y
发帖数: 257
3
来自主题: JobHunting版 - 问两道facebook面试题
That answer is wrong,
it should be
int left = maxSum(root->left, max);
int right = maxSum(root->right, max);
int sum = left + right + root->data;
int localMax = max(sum, max(left,right));
if(sum > *max)
*max = sum;
return max;
t****1
发帖数: 934
4
来自主题: Computation版 - 求每个波峰对应点
try localmax(vector)
(共0页)