https://leetcode.com/problems/path-sum-iii You are given a binary tree in which each node contains an integer value. Find the number of paths that sum ...
分类:
其他好文 时间:
2018-11-17 00:26:27
阅读次数:
250
一、题目描述 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right a ...
分类:
其他好文 时间:
2018-11-16 18:49:07
阅读次数:
197
分析后首先想到排列组合,后来发现很复杂,不是一个简单的排列组合问题。之后又联想到面商汤时遇到的递归/DP的题,填补2*n矩阵那个。于是开始尝试递归/DP。 首先递归,但是超时了。 Time Limit Exceeded 毕竟有太多重复调用了。那就DP吧。 1ms,20.84%。 有空看下更优解。 ...
分类:
其他好文 时间:
2018-11-13 12:19:09
阅读次数:
200
图像化显示目录工程结构:tree 创建ROS工作空间 下载别人的GitHub代码包 1、在catkin_ws/src中: 2、安装包所需的依赖 $ cd ~/catkin_ws $ rosdep install --from-paths src --ignore-src --rosdistro=ki ...
分类:
其他好文 时间:
2018-11-09 21:07:58
阅读次数:
156
package com.fenye.puil.usbDemo;import java.nio.file.FileSystems;import java.nio.file.Path;import java.nio.file.Paths;import java.nio.file.StandardWatc ...
分类:
编程语言 时间:
2018-11-09 10:45:37
阅读次数:
193
题意: 给你两个数n,m,代表n*m的矩阵,让你求,从左下角走到右上角的方法数; 走法是只能往上走或者往右走。 这个题就是求组合数 从左下角走到右上角一共走n+m步,必须得走n步或者m步,所以从n+m中选择n步或者m步。 所以直接求Cnn+m 或者Cmn+m 都是答案 代码: ...
分类:
其他好文 时间:
2018-11-07 00:50:23
阅读次数:
171
G. Two-Paths time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output G. Two-Paths time limit p ...
分类:
其他好文 时间:
2018-11-04 14:02:12
阅读次数:
152
题目大意:给你一棵树,点有点权$a_{i}$,边有边权$w_{e}$,定义一种路径称为$2-path$,每条边最多经过2次且该路径的权值为$\sum _{x} a_{x}\;-\;\sum_{e}w_{e}\cdot k_{e}$,$k_{e}$为边的经过次数,一共$Q$次询问,每次查询经过$x,y ...
分类:
其他好文 时间:
2018-11-03 00:04:00
阅读次数:
171
题目大意:给你一棵树,其中点上和边上都有值。定义2-Path为经过一条边最多两次的路径,价值为经过点的权值加和-经过边权值*该边经过次数。4e5组询问,每次询问树上连接x,y两点的2-Path的最大价值。 题解: 一道状态比较多的树形dp。 dp1:记录x点子树内从x到x的最大2-Path的价值-x ...
分类:
其他好文 时间:
2018-11-01 11:45:02
阅读次数:
152
poj1942 Paths on a Grid 题意:给定一个长m高n$(n,m \in unsigned 32-bit)$的矩形,问有几种走法。$n=m=0$时终止。 显然的$C(m+n,n)$ 但是没有取模,n,m的范围又在unsigned int 范围内 于是有一种神奇的方法↓↓ 1 #inc ...
分类:
其他好文 时间:
2018-10-31 15:45:22
阅读次数:
132