zoukankan      html  css  js  c++  java
  • Kattis

     

     

    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 1Sample 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
    ", sum);
        }
        return 0;
    }
  • 相关阅读:
    (三)通用定时器的定时功能(不使用中断)
    (二)STM32中中断优先级理解
    (一)通用定时器的相关介绍
    Ambari client
    Ambari的资源池管理
    Sentry的授权模型
    关于yum
    Ambari-HDP
    Ambari的API调用
    CentOS上面搭建SVN服务器
  • 原文地址:https://www.cnblogs.com/zhien-aa/p/6294383.html
Copyright © 2011-2022 走看看