Description ICPC (Isles of Coral Park City) consist of several beautiful islands. The citizens requested construction of bridges between islands to resolve inconveniences of using boats between islands, and they demand that all the islands should be…
题目链接:传送门 题意: 有n个点.m条边.要使n个点所有连起来且要花费最小.问有哪些边是必需要连的. 分析: 要使花费最小肯定是做最小生成树.可是题目要求哪些边是必需要用的.我们能够 这样思考,我们先求一次最小生成树,然后把这些用到的边统计起来,然后依次枚 举这n-1条边.使他们不能用,然后继续做最小生成树,假设最后求的值和第一次 不一样的话那么这条边是肯定要连的. 代码例如以下: #include <iostream> #include <cstdio> #include &l…
题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1116 解题报告:一个国家有n个城市,有m条路可以修,修每条路要一定的金币,现在这个国家只有K个金币,每个城市有一些人,要你求怎么修路使得总的费用在K的范围内,同时使得跟首都连接的城市的人口(包括首都的人口)要最多,问最多的人口是多少. 枚举连接哪些城市,然后分别构造最小生成树. #include<cstdio> #include<cstring> #include<…
Description ICPC (Isles of Coral Park City) consist of several beautiful islands. The citizens requested construction of bridges between islands to resolve inconveniences of using boats between islands, and they demand that all the islands should be…
There is No Alternative 题目连接: http://codeforces.com/gym/100803/attachments Description ICPC (Isles of Coral Park City) consist of several beautiful islands. The citizens requested construction of bridges between islands to resolve inconveniences of u…
原文地址:http://tieba.baidu.com/p/2432943599 前言: 即将进入研二,ACM的事情也渐渐远去,记忆终将模糊,但那段奋斗永远让人热血沸腾.开个贴讲讲ACM与中南的故事,当是宣泄,也当是一种宣传吧.多年不写作文,也不知如今的文笔能否打动更多的有志青年为中南ACM梦想而奋斗. 用时间序好了,不定时更新.一层楼对应一个时期或一年,有补充就在那层楼的中.也许真写起来故事不长,就这样吧.   1947年 ACM(Association for Computing Machi…
There is No Alternative Time Limit: 3000ms Memory Limit: 262144KB This problem will be judged on Aizu. Original ID: 135064-bit integer IO format: %lld      Java class name: Main   ICPC (Isles of Coral Park City) consist of several beautiful islands.…
以此图为例: package com.datastruct; import java.util.Scanner; public class TestKruskal { private static class Edge{ public Edge(int begin,int end,int weight){ this.begin = begin; this.end = end; this.weight = weight; } int begin; int end; int weight; publ…
坏味道--异曲同工的类(Alternative Classes with Different Interfaces) 特征 两个类中有着不同的函数,却在做着同一件事. 问题原因 这种情况往往是因为:创建这个类的程序员并不知道已经有实现这个功能的类存在了. 解决方法 如果两个函数做同一件事,却有着不同的签名,请运用 函数改名(Rename Method) 根据它们的用途重新命名. 运用 搬移函数(Move Method) . 添加参数(Add Parameter) 和 令函数携带参数(Parame…
最小生成树计数 (1s 128M) award [问题描述] 现在给出了一个简单无向加权图.你不满足于求出这个图的最小生成树,而希望知道这个图中有多少个不同的最小生成树.(如果两颗最小生成树中至少有一条边不同,则这两个最小生成树就是不同的).由于不同的最小生成树可能很多,所以你只需要输出方案数对31011的模就可以了. [输入格式] 第一行包含两个数,n和m,其中1<=n<=100; 1<=m<=1000; 表示该无向图的节点数和边数.每个节点用1~n的整数编号.接下来的m行,每行…