Objhdu2001java
计算两点间的距离
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 168512 Accepted Submission(s):
59478
import java.util.*;
class Mian{
public static void main(String args[])
{Scanner cin=new Scanner(System.in);
while(cin.hasNext())
{ double x1=cin.nextDouble();
double y1=cin.nextDouble();
double x2=cin.nextDouble();
double y2=cin.nextDouble();
Point p1=new Point(x1,y1);
Point p2=new Point(x2,y2);
double dis=p2.distance(p1);
System.out.printf("%.2f",dis);
System.out.println();
}
}
}
class Point{
private double x;
private double y;
public Point(double x,double y)
{ this.x=x;
this.y=y;
}
public double distance(Point p)
{double dis=Math.sqrt((this.x-p.x)*(this.x-p.x)+(this.y-p.y)*(this.y-p.y));
return dis;
}
}
Objhdu2001java的更多相关文章
- Sql Server tempdb原理-缓存机制解析实践
Tempdb就像Sqlserver的临时仓库,各式各样的对象,数据在里面进行频繁计算,操作.大量的操作使得tempdb可能面临很大压力,tempdb中缓存的设计就是为了缓解这些压力.这次就为大家介绍下 ...
随机推荐
- 移动应用产品开发-android开发项目记录
今天主要在做app前端开发,做了一个资讯列表和资讯详情,主要模仿网易新闻来做,页面布局简单,但java代码和实现比较麻烦 毕竟才开始做,研究的不那么透彻,也不是很熟练 用心去做,专注开发,今天也算作出 ...
- 通过硬件层提高Android动画的性能
曾有许多人问我为什么在他们开发的应用中,动画的性能表现都很差.对于这类问题,我往往会问他们:你们有尝试过在硬件层解决动画的性能问题么? 我们都知道,在播放动画的过程中View在每一帧动画的显示时重绘自 ...
- Github上更新自己Fork的代码
一.前提本文的前提是你已经在github上fork了别人的分支,并且弄好了跟github的ssh连接.相关配置详情参考:https://help.github.com二.详细操作 检出自己在githu ...
- struts2结合生成验证码
import java.util.Arrays; /** * 工具类,生成随机验证码字符串 * @version 1.0 2012/12/01 * @author shiyz * */ public ...
- “net.tcp://localhost:9000/ObtainData”处带有协定“"IObtainData"”的 ChannelDispatcher 无法打开其 IchannelListener。
http://stackoverflow.com/questions/1252791/how-to-solve-the-channeldispatcher-is-unable-to-open-its- ...
- xcode duplicate symbol _GAD_MD5 解决方法
添加了mobi的广告平台后,在Device状态打包时,出现此错误. duplicate symbol _GAD_MD5 in: 解决方法: Targets ->Build Setting 中设 ...
- 如何设置SVN提交时强制添加注释
windows版本: 1.新建一个名为pre-commit.bat的文件并将该文件放在创建的库文件的hooks文件夹中 2.pre-commit.bat文件的内容如下: @echo off set S ...
- Code generated using the T4 templates for Database First
Error message: Code generated using the T4 templates for Database First and Model First development ...
- HDOJ 1004题 Let the Balloon Rise strcmp()函数
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- 删除顺序链表中重复的数 (一) leecode
Given a sorted linked list, delete all duplicates such that each element appear only once. For examp ...