HDOJ2001 兩點座標的距離

2022-05-22 10:24:12 字數 478 閱讀 7424

problem description

輸入兩點座標(x1,y1),(x2,y2),計算並輸出兩點間的距離。

input

輸入資料有多組,每組佔一行,由4個實數組成,分別表示x1,y1,x2,y2,資料之間用空格隔開。

output

對於每組輸入資料,輸出一行,結果保留兩位小數。

sample input

0 0 0 1

0 1 1 0

sample output

1.00

1.41

**實現:

1 #include2 #include3

intmain()410

return0;

1112 }

1.區別於2000這裡不需要在scanf()裡照顧下一次的測試格式,因為輸入格式是實數不再是字元。

2.控制小數點後位數,例如1的%2.2lf輸出就是空格空格1.00

HDOJ 2001 計算兩點間的距離

problem description 輸入兩點座標 x1,y1 x2,y2 計算並輸出兩點間的距離。input 輸入資料有多組,每組佔一行,由4個實數組成,分別表示x1,y1,x2,y2,資料之間用空格隔開。output 對於每組輸入資料,輸出一行,結果保留兩位小數。sample input 0 ...

php 計算兩點地理座標的距離

功能 根據圓周率和地球半徑係數與兩點座標的經緯度,計算兩點之間的球面距離。獲取兩點座標距離 計算兩點地理座標之間的距離 param decimal longitude1 起點經度 param decimal latitude1 起點緯度 param decimal longitude2 終點經度 p...

HDU 2001 計算兩點間的距離

problem description 輸入兩點座標 x1,y1 x2,y2 計算並輸出兩點間的距離。input 輸入資料有多組,每組佔一行,由4個實數組成,分別表示x1,y1,x2,y2,資料之間用空格隔開。output 對於每組輸入資料,輸出一行,結果保留兩位小數。sample input 0 ...