各位早 蒟蒻求助 改了114514遍了 过样例 全wa

P5735 【深基7.例1】距离函数

homoteam_ikun @ 2023-01-31 04:33:08

rt 下为代码

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
double homo(double x1,double x2,double y1,double y2){
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int main(){
    double x1,x2,x3,y1,y2,y3,sum=0;
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    sum=homo(x1,y1,x2,y2);
    sum+=homo(x1,y1,x3,y3);
    sum+=homo(x2,y2,x3,y3);
    cout<<fixed<<setprecision(2)<<sum;
}

我吐了 这破红题调一晚上了


by homoteam_ikun @ 2023-01-31 04:34:42

头疼 先去睡了 7点见


by lraM416 @ 2023-01-31 06:18:04

abs?


by Wzc_DL24JP @ 2023-01-31 07:33:20

把木毛改成内联再试试


by ljk8886 @ 2023-01-31 07:33:54

把x1-x2改成x2-x1,y1-y2改成y2-y1试试?


by Wzc_DL24JP @ 2023-01-31 07:34:36

木毛函数参数顺序错了,好好看看函数声明


by Wzc_DL24JP @ 2023-01-31 07:35:25

太不仔细了,活该被评测机雷普三回啊三回(恼


by Wzc_DL24JP @ 2023-01-31 07:36:53

double homo(double x1,double x2,double y1,double y2){

改成

double homo(double x1,double y1,double x2,double y2){

by Wzc_DL24JP @ 2023-01-31 07:37:45

@Algae 平方有非负性


by lraM416 @ 2023-01-31 08:02:38

az,我傻逼


by homoteam_ikun @ 2023-01-31 13:59:21

终于ac了 此贴终 (下次再也不深夜写题了 迷糊)


| 下一页