P10859 求调
  • 板块题目总版
  • 楼主wudaojiushu
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/8/12 09:39
  • 上次更新2024/8/12 09:54:10
查看原帖
P10859 求调
725268
wudaojiushu楼主2024/8/12 09:39
#include<bits/stdc++.h>
using namespace std;
int n,x[105],y[105],T;
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d",&n);
		for(int i=1;i<=n;i++)scanf("%d%d",&x[i],&y[i]);
		auto Get=[&](long double x1,long double y1,long double x2,long double y2,long double x3,long double y3){
			return 1.0/2.0*(x1*y2+x2*y3+x3*y1-x1*y3-x2*y1-x3*y2+1);
		};
		long double ans=4e18;
		for(int i=1;i<=n;i++)
			for(int j=i+1;j<=n;j++)
				for(int k=j+1;k<=n;k++){
					long double t=Get(x[i],y[i],x[j],y[j],x[k],y[k]);
					t=fabs(t);
					if(t<1)continue;
					ans=min(ans,t);
				}
		if(ans==4e18){
			printf("-1\n");
			continue;
		}
		cout<<setprecision(6)<<ans<<endl;
	}	
	return 0;
}

编译错误

2024/8/12 09:39
加载中...