标签:problem desc scanf int sam import while algo math
#include <stdio.h> #include <string.h> #include <algorithm> #include <iostream> #include <math.h> int main() { double a, b, c, d; double result; while(scanf("%lf %lf %lf %lf", &a, &b, &c, &d) != EOF){ double x = (a-c) * (a-c); double y = (b-d) * (b-d); printf("%.2lf\n",sqrt(x+y)); } }
Java源代码:
import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sin=new Scanner(System.in); while(sin.hasNextDouble()){ double a, b, c, d; a = sin.nextDouble(); b = sin.nextDouble(); c = sin.nextDouble(); d = sin.nextDouble(); double x = (a-c) * (a-c); double y = (b-d) * (b-d); double result = Math.sqrt(x+y); String res = String .format("%.2f", result); System.out.println(res); } } }
标签:problem desc scanf int sam import while algo math
原文地址:http://www.cnblogs.com/hey-man/p/6826801.html