题目链接:http://ac.jobdu.com/problem.php?pid=1144 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: // // 1144 Freckles.cpp // Jobdu // // Created by PengFei_Zheng on 18/04/2017. // Copyright © 2017 PengFei_Zheng. All rights reserved. // #include <s…
[九度OJ]题目1144:Freckles 解题报告 标签(空格分隔): 九度OJ 原题地址:http://ac.jobdu.com/problem.php?pid=1144 题目描述: In an episode of the Dick Van Dyke show, little Richie connects the freckles on his Dad's back to form a picture of the Liberty Bell. Alas, one of the freck…
虽然是道普通的最小生成树题目,可还是中间出了不少问题,暴露的一个问题是不够细心,不够熟练.所以这篇博客就当记录一下bug吧. 代码一:kruskal #include<stdio.h> #include<math.h> #include<stdlib.h> #include<string.h> #define N 110 typedef struct { double x,y; } Point; Point point[N]; typedef struct…
#include<iostream> #include<cstring> #include<stdio.h> #include<queue> #include<cmath> #include<algorithm> #include<string> using namespace std; ]; int findRoot(int x) // 查找节点x所在树的根节点 { ) return x; else { // 路径优化…
题意:就是说有A.B两个公司要修路,有m条路,可能是属于A修的,也可能是属于B修的,现在要求所有路都联通的情况下的最小权值,并且A公司必须要修k条路. 同: 代码: #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; struct node { int v1,v2; int w; } s[100005],t[100005]…
买还是建 紫书P358 [题目链接]买还是建 [题目类型]最小生成树 &题解: 这题真的心累,看了3天,最后照着码还是wa,先放lrj代码,以后再看吧 &代码: // UVa1151 Buy or Build // Rujia Liu #include <cstdio> #include <cmath> #include <cstring> #include <vector> #include <algorithm> using…
苗条的生成树 紫书P358 这题最后坑了我20分钟,怎么想都对了啊,为什么就wa了呢,最后才发现,是并查集的编号搞错了. 题目编号从1开始,我并查集编号从0开始 = = 图论这种题真的要记住啊!!题目大部分都是从1开始编号,而代码大部分是从0开始编号,所以要把输入减减. [题目链接]苗条的生成树 [题目类型]最小生成树+并查集 &题解: 如果你看懂了Kruskal算法,那么这个也就很好懂了. 首先按边排序,之后找个连续的区间[L,R] 判断是否已经是生成树,如果是,更新答案就好. 判断是否为生成…
题目大意:在三维坐标中给出n个细胞的x,y,z坐标和半径r.如果两个点相交或相切则不用修路,否则修一条路连接两个细胞的表面,求最小生成树. 题目思路:最小生成树树模板过了,没啥说的 #include<cstdio> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> #include<cstring> #include<vector&g…
// 下一篇:分数和checklist 如何设计题目 教学中的一个问题是老师出题太简单了,题目设计一开始上来就不紧凑,我认为一个好的课程应该上来就给你紧凑感,而不是先上来"轻松2-3周".目前见到的程序性题目有几类,都可以分别作不同层度的扩展设计. 问答类型题目,这类题目最好要有进阶,否则容易变成水题: 基础知识问答 扩展知识问答 高级深度问答 工具类题目,这类题目最好有明确要求: step by step的操作记录,这也是以后写specification的基础训练 对工具原理的理解和…
转载请注明原创出处,谢谢! 题目回顾 JVM菜鸟进阶高手之路十三,问题现象就是相同的代码,jvm参数不一样,表现的现象不一样. private static final int _1MB = 1024 * 1024; public static void main(String[] args) throws Exception { byte[] all1 = new byte[2 * _1MB]; byte[] all2 = new byte[2 * _1MB]; byte[] all3 = n…