http://hihocoder.com/problemset/problem/1014这个树感觉像是26叉树~ 写起来和普通的二叉树差不多。 编译~对比:struct BinayNode{ int data; BinaryNode *l,*r; // 二叉的,有两个子...
分类:
其他好文 时间:
2015-02-02 00:38:18
阅读次数:
204
拓扑排序的算法package ToPu;public class Graph { private final int MAX_VERTS = 20; private Vertex vertexList[]; private int adjMat[][]; private int nVerts; pr...
分类:
编程语言 时间:
2015-01-31 00:21:25
阅读次数:
255
#1094 : Lost in the City时间限制:10000ms单点时限:1000ms内存限制:256MB描述Little Hi gets lost in the city. He does not know where he is. He does not know which direc...
分类:
其他好文 时间:
2015-01-30 10:39:24
阅读次数:
225
hdu 1285 确定比赛名次
Description
有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。
Inpu...
分类:
编程语言 时间:
2015-01-30 09:06:12
阅读次数:
214
题意:有n种正放形,每种正方形的数量可视为无限多。已知边与边之间的结合规则,而且正方形可以任意旋转和反转,问这n中正方形是否可以拼成无限大的图案。分析:首先因为可以旋转和反转,所以可以保证在拼接的过程中正方形不会自交。把边的标号看成点,将正方形的边界A+变成B+可以看做是一条边。比如说,一个正方形中...
分类:
编程语言 时间:
2015-01-29 01:21:32
阅读次数:
127
题目链接:
1105
一共两种操作 放入和取出(MAX)的
最多有10W次操作 ,暴力肯定会超时。
我们可以将盒子理解为一个大顶堆,即父节点大于左右子节点。
1.每次放入糖果时往上维护堆
2.取出时模仿堆排序的算法 将根节点(max)输出并与最后一个节点交换 再维护堆
代码:
#inclu...
分类:
其他好文 时间:
2015-01-27 11:20:47
阅读次数:
159
Crazy Shopping(拓扑排序+完全背包)Because of the 90th anniversary of theCoherent & Cute Patchouli(C.C.P),Kawashiro Nitoridecides to buy a lot of rare things to...
分类:
编程语言 时间:
2015-01-26 20:57:38
阅读次数:
220
对AOV网进行拓扑排序的基本思路是:
从AOV网中选择一个入度为0的顶点输出,然后删去此顶点,并删除以此顶点为尾的弧,继续重复此步骤,直到输出全部顶点或者AOV网中不存在入度为0的顶点为止。
AOV网及邻接表数据结构:
代码:
#include "stdio.h"
#include "stdlib.h"
#include "io.h"
#include "math.h...
分类:
编程语言 时间:
2015-01-26 12:06:08
阅读次数:
252
#include
#include
#include
#include
#include
using namespace std;
const int maxn=30;
int head[maxn],ip,indegree[maxn];
int n,m,seq[maxn];
struct note
{
int v,next;
} edge[maxn*maxn];
void ...
分类:
编程语言 时间:
2015-01-25 21:05:21
阅读次数:
274
http://poj.org/problem?id=1094
Description
An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to larges...
分类:
编程语言 时间:
2015-01-25 19:39:31
阅读次数:
185