成功地编译失败,悬棺

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

_mei_tou_nao_ @ 2024-08-19 13:28:59


using namespace std;
double a, b, c, d, x1, y1, x2, y2, x3, y3;

int main() {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
    b = sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2));
    c = sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2));
    d = a + b + c;
    cout << fixed << setprecision(2) << d;
    return 0;
}

by _czx6666_ @ 2024-08-19 13:35:41

y1不行 @_mei_tounao


by FireFy @ 2024-08-19 13:39:53

#include <bits/stdc++.h>
using namespace std;

int main()
{
    double a, b, c, d, x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
    b = sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2));
    c = sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2));
    d = a + b + c;
    cout << fixed << setprecision(2) << d;
    return 0;
}

全局的问题@_mei_tounao


by _mei_tou_nao_ @ 2024-08-19 13:40:48

@czx6666 @xjx @sapo1o @BVVd @czx6666 大家不好意思,我去上厕所了


by BVV_d_ @ 2024-08-19 13:40:48

using namespace std;
double a, b, c, d, x1, y1, x2, y2, x3, y3;

int main() {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
    b = sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2));
    c = sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2));
    d = a + b + c;
    cout << fixed << setprecision(2) << d;
    return 0;
}

实测楼主这个加万能头编译0E0W


by _mei_tou_nao_ @ 2024-08-19 13:41:40

@czx6666 @FireFy 谢谢,已关


by _czx6666_ @ 2024-08-19 13:42:06

y1和bits库有一个变量重了 @_mei_tounao


by BVV_d_ @ 2024-08-19 13:42:36

@_mei_tounao

你一开始的加万能头就编译过了


by _mei_tou_nao_ @ 2024-08-19 13:44:29

@BVVd @czx6666 OK,谢谢


by Tiskan_H @ 2024-08-19 13:58:19

万能头不可以用x1,x2,y1,y2等,这是cmath里的函数名


by Tiskan_H @ 2024-08-19 13:58:51

用 iostream就好了 @_mei_tounao


上一页 | 下一页