POJ 2075 Tangled in Cables (c++/java)】的更多相关文章

http://poj.org/problem?id=2075 题目大意: 给你一些人名,然后给你n条连接这些人名所拥有的房子的路,求用最小的代价求连接这些房子的花费是否满足要求. 思路: 昨天20分钟的题,输入不小心写错了- -|||||看世界杯半场歇息随便看了下发现了....T T 用map进行下标的映射,然后求MST就可以. c++ #include<cstdio> #include<string> #include<map> #include<algorit…
简单的最小生成树,不过中间却弄了很久,究其原因,主要是第一次做生成树,很多细节不够熟练,find()函数的循环for判断条件是 pre[i]>=0,也就是遇到pre[i]==-1时停止,i就是并查集的代表元. #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #define MAXN 1000 #define MAXE 1000010 #define LEN…
    Exponentiation Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 126980   Accepted: 30980 Description Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of t…
#include<iostream> #include<stdio.h> #include<string> #include<map> #include<iomanip> #define MAXN 500 #define inf 1000000000 typedef double elem_t; using namespace std; double _m[MAXN][MAXN]; int pre[MAXN]; map<string,int…
/** 题意:     给你两个城市之间的道路(无向图),求出需要的     电缆.如果大于所提供的,就输出Not enough ...     否则输出所需要的电缆长度.       输入:N (给定的电缆总长度)           m1 (有多少个城市—)           str1           str2           str3           str4           :           :(城市的名字)             m2(相当于给出m2条边)  …
描述 You are the owner of SmallCableCo and have purchased the franchise rights for a small town. Unfortunately, you lack enough funds to start your business properly and are relying on parts you have found in an old warehouse you bought. Among your fin…
POJ图论分类[转] 一个很不错的图论分类,非常感谢原版的作者!!!在这里分享给大家,爱好图论的ACMer不寂寞了... (很抱歉没有找到此题集整理的原创作者,感谢知情的朋友给个原创链接) POJ:http://poj.org/ 1062* 昂贵的聘礼 枚举等级限制+dijkstra 1087* A Plug for UNIX 2分匹配 1094 Sorting It All Out floyd 或 拓扑 1112* Team Them Up! 2分图染色+DP 1125 Stockbroker…
题目链接:http://poj.org/problem?id=1503 import java.io.*; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String []args) throws IOException{ Scanner scanner=new Scanner(System.in); BigInteger a=BigIntege…
http://poj.org/problem?id=1129 import java.util.*; import java.math.*; public class Main { public static boolean flag=false; public static int ans=0; public static void main(String []args) { Scanner cin=new Scanner(System.in); int n; String str; whil…
打2017icpc沈阳站的时候遇到了大数的运算,发现java与c++比起来真的很赖皮,竟然还有大数运算的函数,为了以后打比赛更快的写出大数的算法并且保证不错,特意在此写一篇博客, 记录java的大数运算,也算是ACM java写法的入门: 学习博客:https://www.cnblogs.com/wkfvawl/p/9377441.html 进入到eclipse界面 第一步:file->new->java project->起名->finish 第二步:进入到刚才建的工程里,右键s…