题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=284 题意:在一个给定图中,铁墙,河流不可走,砖墙走的话,多花费时间1,问从起点到终点至少需要多少时间. 思路:简单广搜~ 代码如下: #include "stdio.h" //nyoj 284 坦克大战 简单搜索 #include "string.h" #include "queue" using namespace std; #def…
坦克大战 时间限制:1000 ms  |  内存限制:65535 KB 难度:3   描述 Many of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now. What we are discussing is a simple edition of this game. Given a map that…
这类带权的边的图,直接广搜不行,要加上优先队列,这样得到的结果才是最优的,这样每次先找权值最小的,代码如下 #include <stdio.h> #include <iostream> #include <queue> #include <string.h> using namespace std; typedef struct Node{ int x, y; int step; friend bool operator < (const Node &…
坦克大战 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描写叙述 Many of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now.  What we are discussing is a simple edition of this game. Given a map that…
题目链接:http://acm.nyist.net/JudgeOnline/status.php?pid=284 特殊数据: 5 5 BBEEY EEERB SSERB SSERB SSETB 7 非优先队列: #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<string> #include<cmath> #inclu…
题目链接 描述 Many of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now. What we are discussing is a simple edition of this game. Given a map that consists of empty spaces, rivers, stee…
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1459 题意:中文题诶- 思路:带权值的最短路,这道题数据也没啥特殊,spaf,floyd, dijkstra 都可以过,我这里就写个dijkstra好了... dijkstra算法和最小生成树的prime有点像,prime算法是将所有点分成两个点集s, w,初始时s中只有一个点,然后依次将w中距离s集合最近的点加入s集合中,直至w为空集.. 这两个算法的区别…
畅通project Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16075    Accepted Submission(s): 6677 Problem Description 省政府"畅通project"的目标是使全省不论什么两个村庄间都能够实现公路交通(但不一定有直接的公路相连,仅仅要能间接通过公路可达就可以).经过…
先上一波题目 https://www.luogu.org/problem/P2024 通过这道题复习了一波并查集,学习了一波带权值操作 首先我们观察到 所有的环都是以A->B->C->A这样的三元环形式存在的 不同动物之间的关系有三种 同类 吃 被吃 那么我们用+1表示吃 +2表示被吃 0表示同类就可以很清楚的记录不同动物的关系了 这样我们只需要在合并并查集的时候对路径的权值进行一定的操作 就可以记录不同动物之间的关系以便查询了 #include<cstdio> #inclu…
例题:http://poj.org/problem?id=1986 POJ1986 Distance Queries Language: Default Distance Queries Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 18225   Accepted: 6265 Case Time Limit: 1000MS Description Farmer John's cows refused to run in…