Input

The input file contains up to 10001000 test cases,

each of which contains five real numbers, x1 y1 x2 y2 px1 y1 x2 y2 p,

each of which have at most 1010 digits past the decimal point.

All are in the range (0,100](0,100]. The last test case is followed by a line containing a single zero.

Output

For each test case output the pp-norm distance between the two points (x1,y1)(x1,y1) and (x2,y2)(x2,y2).

The answer should be accurate within 0.00010.0001 error.

Sample Input 1 Sample Output 1
1.0 1.0 2.0 2.0 2.0
1.0 1.0 2.0 2.0 1.0
1.0 1.0 20.0 20.0 10.0
0
1.4142135624
2.0000000000
20.3636957882

题意

给出x1,y1,x2,y2,p,按照上面最后一个给出来的公式算,水题,没坑

代码

#include<bits/stdc++.h>
using namespace std;
int main() {
double x1, y1, x2, y2, p, sum;
while(scanf("%lf", &x1) && x1 != 0.0) {
scanf("%lf%lf%lf%lf", &y1, &x2, &y2, &p);
sum = pow((pow(fabs(x1 - x2), p) + pow(fabs(y1 - y2), p)), 1.0 / p);
printf("%.10f\n", sum);
}
return ;
}

最新文章

  1. ACM提交结果简介
  2. 又踩.NET Core的坑:在同步方法中调用异步方法Wait时发生死锁(deadlock)
  3. repeater 根据输入 返回汉字
  4. Application Initialization Module for IIS 7.5
  5. cdr创建样式与样式集的方法
  6. 二级域名session 共享方案
  7. 使用Cloudera部署,管理Hadoop集群
  8. js中小数的操作及数字类型的验证
  9. CCNP第一天 Rip综合实验
  10. W5300E01-ARM 交叉编译器(Cross Compiler)用户手册
  11. python顶级执行代码
  12. java学习笔记 --- 条件,循环语句
  13. Python包和版本管理的最好工具----pipenv
  14. fiddler限制网速
  15. IP通信基础学习第六周(下)
  16. https笔记【转】
  17. eclipse如何导入jar包 BUILD PATH
  18. 浅析原生js模仿addclass和removeclass
  19. Linux和windows 查看程序、进程的依赖库的方法
  20. stl源码剖析 详细学习笔记 算法(2)

热门文章

  1. 系统和帮助-Linux基础知识
  2. tween.js缓动(补间动画)
  3. 邓_ PHP&#183;笔记(函数总结)
  4. What identity values you get with the @@IDENTITY and SCOPE_IDENTITY functions
  5. 教你 Shiro + SpringBoot 整合 JWT
  6. (22)Spring Boot 拦截器HandlerInterceptor【从零开始学Spring Boot】
  7. ZooKeeper搭建系列集 (这套很全,也很详细)
  8. 进入Material Design时代
  9. 【slighttpd】基于lighttpd架构的Server项目实战(6)—预备知识之Http
  10. APP漏洞自动化扫描专业评测报告(中篇)