首页 > TAG信息列表 > deepth

LeetCode 报数

https://leetcode-cn.com/problems/count-and-say/description/ 我的解决方案: class Solution { public String solveIt(String str, int deepth) { if(str == "" || str == null) return ""; if(deepth==0) return str; String r

《从头再来》剑指offer.55I 二叉树的深度

输入一棵二叉树的根节点,求该树的深度。从根节点到叶节点依次经过的节点(含根、叶节点)形成树的一条路径,最长路径的长度为树的深度。 利用dfs算法一直向下找寻,直到根结点后返回。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode

POJ2 3498

把冰块拆点来保证企鹅起跳的限制,对于所有点为汇点跑一边最大流看看是不是和企鹅人数相等 #include<bits/stdc++.h> #define FT(a,b) memset(a,b,sizeof(a)) using namespace std; const int N = 300 + 10 ,M = N * N + N * 2 << 1, INF = 0x3f3f3f3f; const double esp = 1e-6;

P4843 清理雪道

上下界网络流最小流 #include <iostream> #include <string> #include <cstring> #include <algorithm> #include <queue> #define FT(a, b) memset(a, b, sizeof(a)) #define FAT(a) memset(a, 0, sizeof(a)) using namespace std; const int N = 500

网络流24题-圆桌问题

二分图匹配的问题 #include<iostream> #include<queue> #include<string> #include<cstring> #include <algorithm> using namespace std; const int N = 420 + 10; const int M = (150*270+N)*2 + 10; const int INF = 0x3f3f3f3f; int n,m,s,t; int

PAT菜鸡笔记1004 Counting Leaves

PAT菜鸡笔记1004 Counting Leaves A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Specification: Each input file contains one test case. Each case starts with a line containing

scrapy 爬虫中间件 deepth深度

源码 class DepthMiddleware(object): def __init__(self, maxdepth, stats, verbose_stats=False, prio=1): self.maxdepth = maxdepth self.stats = stats self.verbose_stats = verbose_stats self.prio = prio @classmethod def from

Python实现斐波那契递归和尾递归计算

##斐波那契递归测试def fibonacciRecursive(deepth): if deepth == 1: return 1 elif deepth == 2: return 1 else: return fibonacciRecursive(deepth - 1) + fibonacciRecursive(deepth - 2)##斐波那契尾递归测试def fibonacciTailRecursive(num