![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
文章平均质量分 54
jqhsdtz
这个作者很懒,什么都没留下…
展开
-
洛谷P2015 二叉苹果树(树状动归)
题目描述 有一棵苹果树,如果树枝有分叉,一定是分2叉(就是说没有只有1个儿子的结点) 这棵树共有N个结点(叶子点或者树枝分叉点),编号为1-N,树根编号一定是1。 我们用一根树枝两端连接的结点的编号来描述一根树枝的位置。下面是一颗有4个树枝的树 2 5 \ / 3 4 \ / 1 现在这颗树枝条太多了,需要剪枝。但是一些树枝上长有苹果。 给定需要保留的树枝数量,求出最原创 2017-10-27 19:08:29 · 18796 阅读 · 0 评论 -
蓝桥杯 算法训练 表达式计算
问题描述 输入一个只包含加减乖除和括号的合法表达式,求表达式的值。其中除表示整除。 输入格式 输入一行,包含一个表达式。 输出格式 输出这个表达式的值。 样例输入 1-2+3*(4-5) 样例输出 -4 数据规模和约定 表达式长度不超过100,表达式运算合法且运算过程都在int内进行。 #inclu原创 2017-11-16 18:47:56 · 18629 阅读 · 0 评论 -
邻接表实现Dijkstra最短路径算法
#include <iostream> #define INF 9999 using namespace std; struct node { int node,next; int weight; }edge[10000]; int first_arc[300],cnt; void addEdge(int x,int y,int w) { edge[cnt].node=y; e...原创 2018-03-18 19:34:30 · 21567 阅读 · 0 评论 -
YTU 1012: A MST Problem
DescriptionIt is just a mining spanning tree ( 最小生成树 ) problem, what makes you a little difficult is that you are in a 3D space.InputThe first line of the input contains the number of test cases in th...原创 2018-03-21 16:19:34 · 18462 阅读 · 0 评论