求大佬调,20分,样例过
查看原帖
求大佬调,20分,样例过
1352651
SunriseLJY楼主2024/10/22 12:55

只过了第一个点...

记录页面

代码

#include<cstdio>
#include<cmath>
using namespace std;

struct T{
	int x, y;
}a[5];
double ans;

int main(){
	for(int i=0; i<3; i++){
		scanf("%d", &a[i].x);
		scanf("%d", &a[i].y);
	}
	
	ans += sqrt(pow(a[2].x - a[1].x, 2) + pow(a[2].y - a[1].y, 2));
	ans += sqrt(pow(a[3].x - a[2].x, 2) + pow(a[3].y - a[2].y, 2));
	ans += sqrt(pow(a[3].x - a[1].x, 2) + pow(a[3].y - a[1].y, 2));
	
	printf("%.2lf", ans);
	
	return 0;
}
2024/10/22 12:55
加载中...