Henry_Yves @ 2024-12-28 21:32:18
错的是最后一组样本点,我给下载下来了,自测是和给的输出一样的
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <string>
#define un unsigned
typedef long long ll;
double my(double a, double b, double c, double d)
{
return pow((pow(abs(a - c), 2) + pow(abs(b - d), 2)), 0.5);
}
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
double a[6];
for (int i = 0; i < 6; i++)
cin >> a[i];
double sum = 0;
sum += my(a[0], a[1], a[2], a[3]);
sum += my(a[0], a[1], a[4], a[5]);
sum += my(a[4], a[5], a[2], a[3]);
cout << fixed << setprecision(2) << sum;
return 0;
}
by SuperBeetle @ 2024-12-28 21:39:15
@Henry_Yves改成
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <string>
#define un unsigned
typedef long long ll;
double my(double a, double b, double c, double d)
{
return sqrt((a - c) * (a - c) + (b - d) * (b - d));
}
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
double a[6];
for (int i = 0; i < 6; i++)
cin >> a[i];
double sum = 0;
sum += my(a[0], a[1], a[2], a[3]);
sum += my(a[0], a[1], a[4], a[5]);
sum += my(a[4], a[5], a[2], a[3]);
cout << fixed << setprecision(2) << sum;
return 0;
}