Johnson 将源点设为$0$,将$0$向每个点连一条边权为$0$的边 先跑一边$SPFA$ 再将$u->v$的一条边的边权增加$dis[u]-dis[v]$ 从每个点开始跑$dijkstra$,求出最短路径,对于一条$s->t$的边,最短路径减去$dis[s]-dis[t]$,就求出了最短路 C ...
分类:
其他好文 时间:
2020-07-20 20:31:03
阅读次数:
89
1、首先需要了解哪些占位符分别代表什么 这些是死知识,把常用的记住,不常用的直接查表就行了 golang 的fmt 包实现了格式化I/O函数,类似于C的 printf 和 scanf。 定义示例类型和变量 type Human struct { Name string } var people = ...
分类:
编程语言 时间:
2020-07-20 15:24:23
阅读次数:
75
package main import ( "golang.org/x/tour/pic" "image/color" "image" ) type Image struct{} func (i Image) ColorModel() color.Model { return color.RGBAM ...
分类:
其他好文 时间:
2020-07-20 13:17:01
阅读次数:
57
参考资料:https://github.com/koding/multiconfig 测试代码: package main import ( "fmt" "github.com/koding/multiconfig" ) type Server struct { Demo DemoConfig } ...
分类:
其他好文 时间:
2020-07-20 13:14:30
阅读次数:
59
#include<stdio.h> #include<stdlib.h> #include<malloc.h> typedef struct LNode{ int data; struct LNode* next; //next是一个指向结构体类型的指针, LNode* 是一个指针数据类型类似int ...
分类:
编程语言 时间:
2020-07-19 23:54:49
阅读次数:
96
#include<stdio.h> #include<stdlib.h> #include<malloc.h> typedef struct LNode{ int data; struct LNode* next; }LNode,*LinkList; LinkList List_TailInsert ...
分类:
编程语言 时间:
2020-07-19 23:53:50
阅读次数:
108
1.面向对象 1.1匿名字段 package main import "fmt" type Person struct { name string sex string age int } type Student struct { Person id int addr string } func ...
分类:
编程语言 时间:
2020-07-19 23:44:14
阅读次数:
77
2.接口 接口定义了一个对象的行为规范。 2.1接口 2.1.1接口类型 Go语言中接口是一种类型,一种抽象类型。 interface是一组methods的集合。 2.1.2为什么要用接口 package main import "fmt" type Cat struct{} func (c Cat ...
分类:
编程语言 时间:
2020-07-19 23:43:38
阅读次数:
86
用了kuangbin大佬的板子 一.二维计算几何模板 1.点 struct Point { double x, y; Point() {} Point(double _x, double _y) { x = _x; y = _y; } void input() { scanf("%lf%lf", & ...
分类:
其他好文 时间:
2020-07-19 23:32:16
阅读次数:
67
容易忘的树基本操作 以中序与任意其他方法遍历建二叉树 // 中序与后续为例 struct node { int data; node *l, *r; }; // 中序的hash数组 int hashIn[MAX]; vector<int> in(MAX), post(MAX); node *crea ...
分类:
编程语言 时间:
2020-07-19 18:09:06
阅读次数:
109