- 博客(4)
- 收藏
- 关注
翻译 ACM 最短路径 POJ1062题解
解题思路:建立源点0,最后我们求的是到点1的最短路径。因为有等级限制,我们只需将符合等级要求间的点设置为连通的,而不符合的点设置为不连通的。这里需要依次枚举最小等级的点。下面是代码:#include<iostream> #include<stdio.h> #include<string.h> #include<map> #include<vec...
2018-03-29 19:20:49 426
原创 ACM 动态规划 POJ 1221 UNIMODAL PALINDROMIC DECOMPOSITIONS 题解
题目: A sequence of positive integers is Palindromic if it reads the same forward and backward. For example: 23 11 15 1 37 37 1 15 11 23 1 1 2 3 4 7 7 10 7 7 4 3 2 1 1 A Palindromic sequence is U...
2018-03-27 21:49:28 369
原创 ACM 动态规划 POJ1042题目分析
题目原文: John is going on a fishing trip. He has h hours available (1 <= h <= 16), and there are n lakes in the area (2 <= n <= 25) all reachable along a single, one-way road. John starts...
2018-03-26 20:44:55 928
原创 ACM__图论__最小生成树算法
求解最小生成树的算法主要有两种,prim算法和kruskal算法,下面分别介绍这两种算法:1. prim算法:算法思想:一共有n个点,每次循环选择一个点加入(这个点肯定是最小代价的点的连线),为了可以更好的在每次循环的时候都能得到最小的代价,所以我引入一个最小代价数组,每次循环,都对这个数组进行维护,这样就可以求出最小生成树了。下面给出代码及其具体注释:#include <iostream&...
2018-03-01 23:18:02 287
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人