Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4112 Accepted Submission(s): 2638
Input 首先輸入一個t,表示有t組數據,跟著t行:
Output 輸出劍氣的最小傷害值M,保留小數點後一位
Sample Input
2 0 0 3 4 4 0 0 3
Sample Output
5.0 5.0
解題思路:x,y為變量就是求亮兩點之間的最短距離
package HDU; import java.util.Scanner; public class P2547 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); while(n-->0){ double a=sc.nextDouble(); double b=sc.nextDouble(); double c=sc.nextDouble(); double d=sc.nextDouble(); System.out.printf(%.1f,Math.sqrt((a-c)*(a-c)+(b-d)*(b-d))); System.out.println(); } } }