Lightoj 1029 - Civil and Evil Engineer】的更多相关文章

1029 - Civil and Evil Engineer    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB A Civil Engineer is given a task to connect n houses with the main electric power station directly or indirectly. The Govt has given him perm…
http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=198#problem/E 水题一道,题意就是让求一遍最小生成树与最大生成树,但我因为Each case contains a blank line and an integer n (1 ≤ n ≤ 100) denoting the number of houses.这句话错了三遍,有两种解决方案,一不用管空格,二gets(str); #include <iostream>…
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1029 题目大意:一个发电站,给n座房子供电, 任意房子之间有电线直接或者间接相连接, 现在想知道需要连接这些房子花费的平均电线长度.平均电线长度 = (最长电线长度 + 最短电线长度)/ 2: 解题思路:裸的最小生成树 代码如下: #include <bits/stdc++.h> using namespace std; ; struct edge { int s, t,…
思路: 利用克鲁斯卡尔算法,最小生成树把边从小到大排序,然后Union: 最大生成树就是把边从大到小排序,然后Union: #include<bits/stdc++.h> using namespace std; typedef __int64 LL; const int N=15000; struct asd{ int u,v; int w; }; asd q[N]; int pre[N],n,num; bool cmp(asd x,asd y) { return x.w<y.w; }…
提高自己的实力, 也为了证明, 开始板刷lightoj,每天题量>=1: 题目的类型会在这边说明,具体见分页博客: SUM=54; 1000 Greetings from LightOJ [简单A+B] 1001 Opposite Task  [简单题] 1002 Country Roads[搜索题] 1003 Drunk[判环] 1004 Monkey Banana Problem [基础DP] 1006 Hex-a-bonacci[记忆化搜索] 1008 Fibsieve`s Fantabu…
Aladdin and the Flying Carpet Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1341 Appoint description:  System Crawler  (2016-07-08) Description It's said that Aladdin had to solve seven myst…
E - Help Hanzo Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1197 Description Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he ha…
http://lightoj.com/volume_showproblem.php?problem=1341 Aladdin and the Flying Carpet Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1341 Description It's said that Aladdin had to solve seven…
Help Hanzo (LightOJ - 1197) [简单数论][筛区间质数] 标签: 入门讲座题解 数论 题目描述 Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he had a little problem with Hanzo Hattori, the best ninja and the love of Nakurur…
Aladdin and the Flying Carpet (LightOJ - 1341)[简单数论][算术基本定理][分解质因数](未完成) 标签:入门讲座题解 数论 题目描述 It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first myste…