想问一下下为什么80分
查看原帖
想问一下下为什么80分
1504215
zlh202483023楼主2024/12/4 16:32
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
double dis(int a, int b, int c, int d);
int main() {
	int x1, x2, y1, y2, x3, y3;
	float a, b, c, sum;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	a = dis(x1, y1, x2, y2);
	b = dis(x1, y1, x3, y3);
	c = dis(x2, y2, x3, y3);
	sum = a + b + c;
	cout << fixed << setprecision(2) << sum;
}

double dis(int a, int b, int c, int d) {
	float distant;
	distant = sqrt((a - c) * (a - c) + (b - d) * (b - d));
	return distant;
}
2024/12/4 16:32
加载中...