读书人

hdu2001解决思路

发布时间: 2013-02-19 11:11:40 作者: rapoo

hdu2001
http://acm.hdu.edu.cn/showproblem.php?pid=2001
一道很简单的题不知道哪里错了,一直是wa感觉没有错呀,就是ac不过去


#include <stdio.h>
#include <stdlib.h>



int main()
{
double x1,x2,y1,y2,res;
while(scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2)!=EOF)
{
res=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
printf("%.2lf\n",res);

}

return 0;
}

[解决办法]
ok..我加了一行 #include<math.h> 就过了..
[解决办法]
楼上正解,sqrt是包含在math.h这个头文件中的

读书人网 >C语言

热点推荐