Chinaunix首页 | 论坛 | 博客
  • 博客访问: 22349
  • 博文数量: 69
  • 博客积分: 1545
  • 博客等级: 上尉
  • 技术积分: 735
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-03 14:17
个人简介

fdsfdsfdsfds

文章分类

全部博文(69)

文章存档

2014年(8)

2012年(61)

我的朋友

分类: Java

2012-04-05 16:07:14

import java.util.*;
public class Main {
  public static void main(String args[]){
 Scanner cin=new Scanner(System.in);
 int n=cin.nextInt();
 Double result=0.00d;
   for(int i=0;i
    Double x1= cin.nextDouble();    
    Double y1= cin.nextDouble();   
    Double x2= cin.nextDouble();   
    Double y2= cin.nextDouble();   
 
    result=Math.pow(x1-x2, 2)+Math.pow(y1-y2, 2);
      java.text.DecimalFormat myformat=new java.text.DecimalFormat("0.00");

      String str = myformat.format(Math.sqrt(result));    
    System.out.println(str);
 
   }
 
  }
  
}
刚开始忘加了 Math.sqrt真是尴尬

 
#include
#include
#include
using namespace std;
int main()
{
/*freopen("1.txt","r",stdin);
freopen("2.txt","w",stdout);*/

double x1,x2,y1,y2,m;
double a;
cin>>m;
while(m--)
{
cin>>x1>>y1>>x2>>y2;
    a=sqrt((double)((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
cout.setf(ios::fixed); 
    cout<
}
return 0;
}
 

        
阅读(160) | 评论(0) | 转发(0) |
0

上一篇:hdu96 水

下一篇:小圆姐的战绩

给主人留下些什么吧!~~