hdu 2001 - 计算两点间的距离 清疚 2022-05-27 00:00 364阅读 0赞 # 地址 # [http://acm.hdu.edu.cn/showproblem.php?pid=2001][http_acm.hdu.edu.cn_showproblem.php_pid_2001] # 定位 # * 数学题 * 水题 # 分析 # * (x2−x1)2\+(y2−y1)2−−−−−−−−−−−−−−−−−−√ # 代码 # **\[cpp\]** view plain copy print ? 1. \#include <iostream> 2. \#include <math.h> 3. \#include <stdio.h> 4. \#include <string.h> 5. 6. using namespace std; 7. 8. int main() \{ 9. double x1,y1,x2,y2; 10. while(scanf(“%lf %lf %lf %lf”,&x1,&y1,&x2,&y2)!=EOF) \{ 11. double tmp=pow(x2-x1,2)+pow(y2-y1,2); 12. tmp=sqrt(tmp); 13. printf(”%.2lf\\n”,tmp); 14. \} 15. return 0; 16. \} # 性能 # <table> <thead> <tr> <th align="center">Exe.Time</th> <th align="center">Exe.Memory</th> <th align="center">Code Length</th> <th align="center">Language</th> </tr> </thead> <tbody> <tr> <td align="center">15MS</td> <td align="center">1880K</td> <td align="center">334B</td> <td align="center">c++</td> </tr> </tbody> </table> [http_acm.hdu.edu.cn_showproblem.php_pid_2001]: http://acm.hdu.edu.cn/showproblem.php?pid=2001
还没有评论,来说两句吧...