hdu 1162 Eddy's picture

在C++中,NULL和nullptr有什么区别? 这两个定义导致了冲突,C++中的NULL如果和C语言一样也是(void *)0指针,而C++不允许void*隐式转换成其它指针类型,那NULL就无法表示空指针了。因此,使用 nullptr可以增加代码的清晰性,避免类型安全问题。即使在混合C++和C代码时,nullptr也提供了一个明确无误的空指针表示,达到兼容的目的。C++11 引入 nullptr 彻底解决了这些问题,提高语言的安全性、清晰性和现代性。在了解NULL和nullptr背后的故事之后,相信大家以后再也不会用NULL了。 阅读详情

Eddy's picture

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4417    Accepted Submission(s): 2180


Problem Description
Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictures to let his friends appreciate. but the result it can be imagined, the friends are not interested in his picture.Eddy feels very puzzled,in order to change all friends 's view to his technical of painting pictures ,so Eddy creates a problem for the his friends of you.
Problem descriptions as follows: Given you some coordinates pionts on a drawing paper, every point links with the ink with the straight line, causes all points finally to link in the same place. How many distants does your duty discover the shortest length which the ink draws?
 

Input
The first line contains 0 < n <= 100, the number of point. For each point, a line follows; each following line contains two real numbers indicating the (x,y) coordinates of the point.

Input contains multiple test cases. Process to the end of file.
 

Output
Your program prints a single real number to two decimal places: the minimum total length of ink lines that can connect all the points.
 

Sample Input
3 1.0 1.0 2.0 2.0 2.0 4.0
 

Sample Output
3.41
 

Author
eddy
 

Recommend
JGShining
 

#include<stdio.h>
#include<math.h>

int N;

struct {
	double x;
	double y;
}Node[101];

double num[101][101];
double closedge[101];

int min()
{
	int i,j;
	double tmp=1000000000;
	for(i=1;i<=N;i++)
	{
		if(closedge[i]!=0 &&closedge[i]<tmp)
		{
			j=i;
			tmp=closedge[i];
		}
	}
	return j;

}

int main(void)
{
	while(scanf("%d",&N)==1)
	{
		int i,j,k;
		double s=0;
		for(i=1;i<=N;i++)
		{
			scanf("%lf%lf",&Node[i].x,&Node[i].y);
		}
		for(i=1;i<=N;i++)
			num[i][i]=0;
		for(i=1;i<=N;i++)
			for(j=i+1;j<=N;j++)
			{
				num[i][j]=sqrt((Node[i].x-Node[j].x)*(Node[i].x-Node[j].x)+(Node[i].y-Node[j].y)*(Node[i].y-Node[j].y));
				num[j][i]=num[i][j];
			}
		for(i=2;i<=N;i++)
		{
			closedge[i]=num[1][i];
		}
		closedge[1]=0;
		for(i=2;i<=N;i++)
		{
			k=min();
			s+=closedge[k];
			closedge[k]=0;
			for(j=1;j<=N;j++)
			{
				if(num[k][j]<closedge[j])
					closedge[j]=num[k][j];
			}
		}
		printf("%.2lf\n",s);
	}
	return 0;
}



Android SystemUI——车载CarSystemUI加载(八) 车载 CarSystemUI 是指专门为汽车环境设计的用户界面和用户体验(UI/UX),它通常与 Android Automotive OS 或其他嵌入式操作系统一起工作,为驾驶者和乘客提供安全、直观且高效的交互方式。Android Automotive OS 是 Google 专门为汽车开发的操作系统版本,它基于 Android 平台,并针对车辆内部的使用进行了优化。 阅读详情

相关推荐

在Cursor IDE中集成Datadog监控:自然语言查询实战指南

在云原生和微服务架构中,可观测性(Observability)已成为保障系统稳定性的核心技术支柱。其核心原理是通过日志(Logs)、指标(Metrics)和追踪(Traces)三大支柱,实时采集并呈现系统的运行状态。这项技术的价值在于,它让开发者能够透视复杂的分布式系统,快速定位性能瓶颈与故障根因。在实际的工程实践中,开发人员常常需要在编码环境与监控平台之间频繁切换,这种上下文切换严重影响了排障效率。本文聚焦于如何利用Model Context Protocol(MCP),将强大的Datadog可观测性平台

weixin_42519772的博客 348

HDOJ 1162 Eddy's picture(最小生成树)

Eddy's picture Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually

nudt_oys的博客 527

深度篇——图像处理的一些方法(一) 关于 图像处理的三个层次 与 selective search

返回主目录 返回 图像处理的一些方法 目录 下一章:深度篇——图像处理的一些方法(二)细说性能评估 IOU和 GIOU 目录内容 深度篇——图像处理的一些方法(一)关于图像处理的三个层次 与 selective search 深度篇——图像处理的一些方法(二)细说性能评估 IOU和 GIOU 深度篇——图像处理的一些方法(三)细说 HOG特征与bag-o...

天下所弃,不过其纪。世间事,在人,在志。 2917

hdu1162 Eddy's picture(Prim算法模板)

Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictu

w1025758212的博客 266

基于boot + 双app升级方案

基于boot+双app的升级方案

weixin_44654285的博客 4515

CANdelaStudio实战:如何用19服务快速编辑DTC快照数据(附Excel模板)

本文详细介绍了在CANdelaStudio中利用19服务高效编辑DTC快照数据的进阶技巧。通过导出DTC池至Excel进行批量编辑,结合‘Copy from DTC Pool’功能实现配置复用,并分享了构建自定义Excel模板与字段映射的实用方法,帮助工程师将繁琐的手动配置转化为工程化的批量处理,大幅提升诊断数据库开发效率。

weixin_29230773的博客 192

hdu1162

Eddy's picture Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2491    Accepted S

ACM 750

保姆级教程如何进行本地局域网布署openclaw小龙虾

全网唯一一篇一步步实战教程,图文并茂方式的方式教你如何本地部署安装小龙虾openclaw

zzw17wei的专栏 1467

hdu1162 Eddy's picture 并查集+最小生成树

Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictur

xtulollipop 456

[RK3568 Android12] 添加自定义启动脚本

1:定义添加的脚本 2:rk3568_s.mk 中定义打包 3:在启动脚本中init.rk356x.rc添加权限及何时启动 4:添加权限文件file_contexts 5:系统确认是否运行

OpenWrt/WLAN/驱动/Android/嵌入式开发总结 2220

【项目实战】SOVD协议(面向服务的车辆诊断协议)

此外,AUTOSAR组织将SOVD部分内容的软件实现定义在了R22-11及以上版本的AUTOSAR Adaptive规范中,还支持动态发现车内诊断功能、获取高性能计算机(HPC)的Log信息等新的诊断需求,更符合当前软件定义汽车概念下的行业趋势。而SOVDGateway作为边缘节点,也肩负着对SOVD Client进行认证以及权限控制的责任,从而保证车辆的信息安全。相较于传统的UDS(Unified Diagnostic Services)协议,SOVD不仅保留了传统的读写数据、例程控制、故障读取等功能,

奶爸的编程之路,也就一周冷个三天 1905

Eddy's picture

Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictu

笑看风云起的专栏 824

由JavaScript版迷宫游戏引出Java版迷宫地图生成器

Java案例:迷宫地图生成器 一、引入问题 本期18软件1班网页脚本实训项目是完成一个JavaScript版迷宫游戏。 迷宫地图是如何生成的呢?很简单,将一个正方形区域等分为若干行与若干列,比如25行25列,这样就有625个单元格,用一个二维数组map[25][25]就可以保存625个单元格信息,map[i][j] = 1表示该单元格要绘制砖,而map[i][j] = 0表示该单元格不绘制砖。 ...

howard2005的专栏 1473

hdu 1162 Eddy's picture(最小生成树Prim算法)

<br />/* Author: ACb0y Date: 2010-9-15 Type: graph(MST prim) ProblemId: hdu 1162 Eddy's picture Result: AC */ #include <iostream> #include <cmath> using namespace std; #define inf 99999999999.9 struct Point { double x; double y; };

个人独立博客http://www.acb0y.cn/ 880

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

HDU 1162 Eddy's picture(最小生成树)

HDU 1162 Eddy's picture(最小生成树) http://acm.hdu.edu.cn/showproblem.php?pid=1162 题意:        给你N个点的坐标,问你最少要连多长的直线可以使得N个点连通. 分析:        最小生成树模板题,直接kruskal. AC代码: #include #include #include #includ

code 865

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

HDU1162-Eddy's picture

http://acm.hdu.edu.cn/showproblem.php?pid=1162 #include<stdio.h> #include<math.h> #include<string.h> #define INF 0x3f3f3f3f #define N 110 struct Node { double x,y; }n...

weixin_30641999的博客 167

hdu 1162 Eddy's picture(最小生成树Kruskal)

<br />/* Author: ACb0y Date: 2010年9月16日1:06:03 Type: MST Kruskal ProblemId: hdu 1162 Eddy's picture Result: 2960095 2010-09-16 01:04:47 Accepted 1162 15MS 480K 1267 B G++ ACb0y */ #include <iostream> #include <cmath> using namespace std;

个人独立博客http://www.acb0y.cn/ 815

hdu 1162 Eddy's picture(Prim算法)

题意:先算出没两点之间的长度,然后直接套用Prim模版就行。 连接:http://acm.hdu.edu.cn/showproblem.php?pid=1162 View Code #include <iostream> #include <cmath> using namespace std; #define INF 0x3fffffff #...

151

hdu1162-Eddy's picture

http://acm.hdu.edu.cn/showproblem.php?pid=1162 #include #include #include #include #include using namespace std; #define MAX 5050 int fa[ MAX ] ; struct node { int x , y ; double value ; bool

bo-jwolf的专栏 1009

HDU 1162 Eddy's picture

Problem Description Eddy begins to like paintingpictures recently ,he is sure of himself to become a painter.Every day Eddydraws pictures in his small room, and he usually puts out his newest picture

涅槃phy的专栏 880

hdu1162Eddy's picture

  Eddy's picture Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11983    Accepted Submission(s): 6017http://acm.hdu.edu.cn/showpro...

一只秀逗__的博客 259

hdu 1162 Eddy's picture prim

Eddy's picture Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5224    Accepted Submission(s): 2595 Problem Description Eddy begins

起航 572

杭电Hdu 1162 Eddy's picture

典型的最小生成树题,我用的prim算法,应该还有其他很多方法。 import java.util.Scanner; public class Hdu1162 {  public static void main(String[] args){   Scanner sc=new Scanner(System.in);      while(sc.hasNext()){   int n=

Zhongyou2010的专栏 595
上一篇: hd 1102 Constructing Roads
下一篇: hd 1233 还是畅通工程
Magic_____
博客等级 码龄14年 11粉丝 160原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值