首页 > 代码库 > HDOJ 2001

HDOJ 2001

 //如果把x1,x2,y1,y2定义为int,则会报Output Limit Exceeded的错误!  #include "stdio.h"#include "math.h"int main(void){	double x1, x2, y1, y2;	double csum;	double distance;	//距离		while(scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2) != EOF){		csum = (double)(x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);		distance = sqrt(csum);				printf("%.2lf\n", distance);				csum = 0.00;		distance = 0.00;	} 		return 0;}

 

HDOJ 2001