最小不相交路径覆盖:使用最小条数的路径,覆盖每个点恰好1次。 最小可相交路径覆盖:使用最小条数的路径,每个点可以覆盖多次。 最小可相交路径覆盖做一次Floyd传递闭包变成最小不相交路径覆盖。 最小不相交路径覆盖使用二分图匹配:把每个点x拆成x1(出度)和x2(入度),初始状态没有匹配,使用的路径数量 ...
分类:
其他好文 时间:
2021-01-06 12:12:01
阅读次数:
0
""" 输入字符串,判断只包含数字、a-z、A-Z、+-的数字串,进行+-,算出最小和 """ import re def sum_s(s): sum = 0 if re.match('^[0-9a-zA-Z+-]+$',s):#判断只包含数字、a-z、A-Z、+-的数字串 list1 = re.f ...
分类:
编程语言 时间:
2021-01-05 11:35:21
阅读次数:
0
求满足
* $\forall i \in [0,n-1],a[i] \in [1,10]$
* $\exist \space 0\leq x < y < z < w <= n,\sum_\limits{i=x}^{y-1}=X,\sum_\limits{i=y}^{z-1}=Y,\sum_\limi... ...
分类:
其他好文 时间:
2021-01-05 11:21:55
阅读次数:
0
使用方式 KafkaProducer 发送消息主要有以下 3 种方式: Properties properties = new Properties(); properties.setProperty("bootstrap.servers", "localhost:9092"); propertie ...
分类:
其他好文 时间:
2021-01-05 10:45:01
阅读次数:
0
这题首先我们可以推出递推式: 我们先把加数个数大于等于 \(2\) 的限制去掉,最后再减回去即可。 \[ f_0=1 \] \[ f_n=\sum\limits_{i=1}^{n} j \cdot f_{i-j} \] 暴力代码: #include<bits/stdc++.h> using name ...
分类:
其他好文 时间:
2021-01-05 10:41:20
阅读次数:
0
#include<stdio.h> int max(int a, int b)//形参 { return a > b ? a : b; } int main() { int x, y; scanf("%d%d", &x, &y); printf("%d", max(x, y));//实际参数 ret ...
分类:
其他好文 时间:
2021-01-04 10:39:27
阅读次数:
0
一.描述 通过二叉树带条件的求和来更好的理解递归 可以参考前两篇文章 一个简单的二叉树的例子来理解递归 二叉树和BST的递归,带条件 二.左叶子求和 来源:https://leetcode-cn.com/problems/sum-of-left-leaves/ 题意为求左叶子节点的值的和 之前文章提 ...
分类:
其他好文 时间:
2021-01-02 11:46:41
阅读次数:
0
给「代码随想录」一个星标吧!?我将公众号文章和学习相关的资料整理到了Github:https://github.com/youngyangyang04/leetcode-master,方便大家在电脑上学习,可以fork到自己仓库,顺便也给个star支持一波吧!?第39题.组合总和题目链接:https://leetcode-cn.com/problems/combination-sum/给定一个无重
分类:
编程语言 时间:
2021-01-02 11:00:22
阅读次数:
0
伪代码: Set sum to0 Read num1 Set sum to sum + num1 Read num2 Set sum to sum + num2 Read num3 Set sum to sum + num3 If (sum<0) Write"Error" Else Write su ...
分类:
其他好文 时间:
2021-01-01 12:06:47
阅读次数:
0
code: #include<bits/stdc++.h>//xfl using namespace std; const int N = 100007; typedef unsigned long long ull; ull mis[N],sum[N]; string s; int n,m,l1, ...