据传这类问题叫做有依赖性的背包问题:选某个物品的同时必须连带选其他物品 容易想到其实是决策发生了变化: 可以选啥都不选 可以只选主件 可以选主件+一个附件 可以选主件+两个附件 其他和01背包一样 struct Bag { int w; int val; Bag(int x = 0,int y = ...
分类:
其他好文 时间:
2020-07-30 22:20:53
阅读次数:
91
Python基础学习(29)基于TCP协议的文件传输 验证客户端合法性 socketserver 模块处理并发客户端请求 一、今日内容 基于 TCP 协议的文件传输 验证客户端合法性 socketserver 模块处理并发客户端请求 二、基于 TCP 协议的文件传输 基本功能实现 # server. ...
分类:
编程语言 时间:
2020-07-30 22:17:38
阅读次数:
88
节点的结构 struct Node { int value; struct Node* next; }; typedef struct Node Node; 基本功能和操作演示 #include <stdio.h> #include <stdlib.h> struct Node { int valu ...
分类:
编程语言 时间:
2020-07-30 22:10:51
阅读次数:
73
#include <bits/stdc++.h> #define MAXN 200005 using namespace std; int node,edge,ans=0,k=0; int fat[MAXN],siz[MAXN]; struct EDGE { int from,to,cost; } ...
分类:
编程语言 时间:
2020-07-30 01:20:30
阅读次数:
71
节点的数据结构 struct Node { int value; struct Node* next; }; typedef struct Node Node; 操作和演示 #include <stdlib.h> #include <stdio.h> // 建立一个节点 Node *createNo ...
分类:
编程语言 时间:
2020-07-30 01:18:43
阅读次数:
82
struct point{ double x, y; }; struct line{ double A, B, C;//Ax + By + C = 0; }; line PPL(point a, point b){// 两点确定直线的一般式 if(a.x == b.x) return line{1, ...
分类:
其他好文 时间:
2020-07-29 17:50:20
阅读次数:
62
// C++ #include<iostream> using namespace std; //链表的定义 struct ListNode { int val; ListNode* next; ListNode(int n) :val(n), next(nullptr) {} }; //链表的打印 ...
分类:
其他好文 时间:
2020-07-29 09:59:12
阅读次数:
68
#include <iostream> #include <map> using namespace std; typedef struct alertInfo { double alertUp; double alertDown; alertInfo(double up, double down) ...
分类:
其他好文 时间:
2020-07-28 22:25:22
阅读次数:
75
邻接表储存结构 /*邻接表的边*/ typedef struct ArcNode { int adjvex; struct ArcNode *next; }ArcNode; /*邻接表的结点*/ typedef struct VNode { char date; ArcNode *firstarc; ...
分类:
编程语言 时间:
2020-07-28 17:32:12
阅读次数:
91
题目 原题链接 解说 刷$Tarjan$题的时候看到的题目,第一次见到把分层图和$Tarjan$结合的题目,觉得这样的思路很有趣,写博客以记之。 总思路:建双层图->Tarjan缩点->最长路 首先看到题目中“只能走一次的逆向边”这样的条件,我们会很自然地想到建一个分层图。每一个点$i$在第二层有一 ...
分类:
其他好文 时间:
2020-07-28 17:19:27
阅读次数:
69