链接: http://poj.org/problem?id=1251 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 21776 Accepted: 10086 Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra road…
Dark roads Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1067 Accepted Submission(s): 474 Problem Description Economic times these days are tough, even in Byteland. To reduce the operating…
#include<iostream> #include<vector> using namespace std; const int N=40010; int pre[N];//并查集 int visit[N];//是否经过 int ancestor[N];//祖先 int dis[N];//储存距离 int result[N];//储存结果 struct tre{ int x,length; }; vector<tre>tree[N]; struct qu{ i…
#include<iostream> #include<vector> using namespace std; const int MAX=10001; int pre[MAX],visit[MAX],indegree[MAX]; vector<int>qury[MAX],tree[MAX]; int ancestor[MAX]; void init(int n) {//初始化 int i; for(i=1;i<=n;i++) { visit[i]=0;…
D - Jungle Roads Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1251 Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extr…
Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensi…
poj 1251 Jungle Roads (最小生成树) Link: http://poj.org/problem?id=1251 Jungle Roads Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 23507 Accepted: 11012 Description The Head Elder of the tropical island of Lagrishan has a problem. A b…
题目: Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too exp…
Jungle Roads 题目链接: http://acm.hust.edu.cn/vjudge/contest/124434#problem/A http://acm.hust.edu.cn/vjudge/contest/124434#problem/L Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on e…
poj 1251 && hdu 1301 Sample Input 9 //n 结点数A 2 B 12 I 25B 3 C 10 H 40 I 8C 2 D 18 G 55D 1 E 44E 2 F 60 G 38F 0G 1 H 35H 1 I 353A 2 B 10 C 40B 1 C 200Sample Output 21630 prim算法 # include <iostream> # include <cstdio> # include <cstr…
题目链接:http://poj.org/problem?id=1273 Time Limit: 1000MS Memory Limit: 10000K Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes…
http://poj.org/problem?id=3461 Oulipo Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 41051 Accepted: 16547 Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a mem…
POJ 1741. Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 34141 Accepted: 11420 Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and…
传送门:http://poj.org/problem?id=1860 题意:给出每两种货币之间交换的手续费和汇率,求出从当前货币s开始交换回到s,能否使本金增多. 思路:bellman-Ford模板题.直接跑一遍,判断是否存在正环就好了.(复杂度n*m) 代码: #include<iostream> using namespace std; int n; //货币种数 int m; //兑换点数量 int s; //持有第s种货币 double v; //持有的s货币的本金 double di…
The Perfect Stall Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 20874 Accepted: 9421 Description Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering pr…
Going Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15944 Accepted: 8167 Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertical…