为啥是0
查看原帖
为啥是0
1470759
zhangjialing1234楼主2025/1/9 12:46
#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int x1, y1, x2, y2, x3, y3, a1, a2, a3, s, ans;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	a1 = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	a2 = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
	a3 = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
	s = (a1 + a2 + a3) / 2;
	ans = sqrt(s * (s - a1) * (s - a2) * (s - a3));
	cout << ans;
	return 0;
}

2025/1/9 12:46
加载中...