PAT
迷麟Milin
There isn't time, so brief is life, for bickerings, apologies, heartburnings, callings to account. There is only time for loving, and but an instant, so to speak, for that. The good life is built with good relationships.
——Mark Twain
展开
-
PAT The Largest Generation
题目描述:A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population....原创 2020-01-27 10:52:01 · 130 阅读 · 0 评论 -
1087 All Roads Lead to Rome
题目大意:单源最短路,利用Dijkstra输出最短路径,当最短路有多条时按照给定原则输出优先级最高者的相关信息及其路径。本题与PAT:1003 Emergency 的差别主要为:1. 顶点不是int型而是给出string型,需要利用map实现顶点string名称和顶点int序号的映射,即:map<string, int> cityid;ma...原创 2019-11-02 22:00:33 · 131 阅读 · 0 评论 -
PAT 1003 Emergency:Dijkstra 单源最短路
思路:本题为Dijkstra求单源最短路径的变形定义:int e[maxn][maxn]; // 边权int dis[maxn]; // 源点到各点的最短距离int num[maxn]; // 源点到各点最短路径的个数int weight[maxn]; // 源点到各点最短路径的点权和int w[maxn]; // 每个点的点权bool vis[maxn]; // 每个点是否被...原创 2019-11-02 19:34:06 · 132 阅读 · 0 评论