https://codeforces.com/contest/1154/problem/G ...
分类:
其他好文 时间:
2019-04-18 00:59:43
阅读次数:
405
There are nn cities and mm roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way. What is the minimum number of new ...
学习博客:https://blog.csdn.net/qq_31759205/article/details/75008659 RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干次询问RMQ(i,j),返回数列A中下标在 ...
分类:
其他好文 时间:
2019-04-15 22:59:59
阅读次数:
175
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo ...
分类:
其他好文 时间:
2019-04-15 16:33:21
阅读次数:
147
一, 通用范式 cmake_minimum_required(VERSION 2.8) project (hello_cpp11) # 检查c++编译器标志,设置c++11支持变量include(CheckCXXCompilerFlag)CHECK_CXX_COMPILER_FLAG("-std=c ...
分类:
编程语言 时间:
2019-04-14 14:04:59
阅读次数:
368
问题: RMQ (Range Minimum/Maximum Query)问题是指:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A中下标在i,j里的最小(大)值,也就是说,RMQ问题是指求区间最值的问题。 dp思想: dp[i][j]中存储的是从第j个数开始的2i ...
分类:
其他好文 时间:
2019-04-11 09:15:12
阅读次数:
172
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l ...
分类:
其他好文 时间:
2019-04-11 01:16:47
阅读次数:
106
#include using namespace std; struct Node{ int x, y, d, c; Node(int x = 0, int y = 0, int d = 0, int c = 0):x(x), y(y), d(d), c(c){} bool operator==(c... ...
分类:
其他好文 时间:
2019-04-10 20:26:18
阅读次数:
119
【链接】 "我是链接,点我呀:)" 【题意】 题意 【题解】 统计叶子节点个数m 把每条和叶子节点相邻的边权设置成s/cnt就可以了 这样答案就是2 s/m(直径最后肯定是从一个叶子节点开始,到另外一个叶子节点结束) 证明: 设dis(i,j)表示节点i和节点j之间的权值和 设a[1],a[2].. ...
分类:
其他好文 时间:
2019-04-09 20:34:58
阅读次数:
140
``` class Solution { public: int minDepth(TreeNode* root) { if (!root) return 0; if (!root->left) return 1 + minDepth(root->right); if (!root->right) ... ...
分类:
其他好文 时间:
2019-04-09 15:09:48
阅读次数:
154