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.
/**
* Definition for binary tree
...
分类:
其他好文 时间:
2014-08-02 23:32:04
阅读次数:
232
Description
The puzzle game of Sudoku is played on a board of N2 × N2 cells. The cells are grouped in N × N squares of N × N cells each. Each cell is either empty or contains a number between
1 a...
分类:
其他好文 时间:
2014-08-02 23:26:34
阅读次数:
344
LightOJ 1205 - Palindromic Numbers (数位dp)
ACM
题目地址:SPOJ MYQ10 Mirror Number
题意:
求[a,b]中回文的个数。
分析:
是SPOJ MYQ01的简单版...其实有非递归方法的。
代码:
/*
* Author: illuz
* Blog: http:...
分类:
其他好文 时间:
2014-08-02 20:56:24
阅读次数:
218
题目链接K-th NumberTime Limit:20000MSMemory Limit:65536KTotal Submissions:36890Accepted:11860Case Time Limit:2000MSDescriptionYou are working for Macrohar...
分类:
其他好文 时间:
2014-08-02 20:46:54
阅读次数:
260
Delay Constrained Maximum Capacity Path
Time Limit:10000MS Memory Limit:65535KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
Consider an undirected graph with N vert...
分类:
其他好文 时间:
2014-08-02 18:31:43
阅读次数:
313
解题报告
题目传送门
题意:
有N个点,点1为珍贵矿物的采矿区, 点N为加工厂,有M条双向连通的边连接这些点。走每条边的运输容量为C,运送时间为D。
他们要选择一条从1到N的路径运输, 这条路径的运输总时间要在T之内,在这个前提之下,要让这条路径的运输容量尽可能地大。
一条路径的运输容量取决与这条路径中的运输容量最小的那条边。
思路:
二分容量建图,spfa判时间是否符合...
分类:
其他好文 时间:
2014-08-02 18:31:13
阅读次数:
375
SPOJ MYQ10 10649. Mirror Number (数位dp)
ACM
题目地址:SPOJ MYQ10 Mirror Number
题意:
求[a,b]中镜像回文的个数。
0
分析:
看到题目和数据范围就知道是数位dp了。
很明显镜像回文只有0,1,8,跟回文的一题一样,在dfs的时候得开个辅助数组记录前面已经选择的数字。
注意还得去掉前...
分类:
其他好文 时间:
2014-08-02 18:27:13
阅读次数:
242
题目链接:点击打开链接
#include
#include
#include
using namespace std;
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;
int main()
{
int i, j;
double m,n;
while...
分类:
其他好文 时间:
2014-08-02 18:20:43
阅读次数:
233
枚举支点之后数位DP,注意姿势#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace st...
分类:
其他好文 时间:
2014-08-02 18:11:43
阅读次数:
301
问题:最大连续子窜和是多少分析:动态规划,定义max记录最大值,sum记录以i结束的连续子窜的最大值class Solution {public: int maxSubArray(int A[], int n) { int sum; int MAX=A[0]; ...
分类:
其他好文 时间:
2014-08-02 17:55:23
阅读次数:
191