HDU 4709 Herding
2013-09-12 17:14
405 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4709
思路:求最小的三角形面积,easy~~~~
思路:求最小的三角形面积,easy~~~~
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <algorithm> using namespace std; #define maxn 110 #define inf 0x3f3f3f3f typedef struct point{ double x,y; }P; P node[maxn]; double Distance(point a,point b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } int main() { int T,n; while(~scanf("%d",&T)){ while(T--){ scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%lf %lf",&node[i].x,&node[i].y); } if(n<3){ printf("Impossible\n"); continue; } double ans = inf ; double a,b,c,p,temp; for(int i=0;i<n;i++){ for(int j =i+1;j<n;j++){ for(int k=j+1;k<n;k++){ a=Distance(node[i],node[j]); b=Distance(node[i],node[k]); c=Distance(node[j],node[k]); p =(a+b+c)/2; temp=p*(p-a)*(p-b)*(p-c); temp=sqrt(temp); if(temp>=0.05 && temp<ans) ans = temp; } } } if(ans == inf) printf("Impossible\n"); else printf("%.2lf\n",ans); } } return 0; }
相关文章推荐
- HDU 4709 Herding (枚举)
- HDU - 4709 Herding
- HDU 4709 Herding
- HDU 4709:Herding
- hdu 4709 Herding
- hdu 4709 Herding
- hdu 4709 Herding
- HDU 4709 Herding
- HDU 4709 Herding(求三角形面积)
- HDU 4709 Herding 解题报告
- HDU 4709 Herding 几何题解
- HDU 4709 Herding
- HDU 4709 Herding
- hdu 4709 - Herding【计算几何-三角形面积】
- HDU 4709 Herding
- hdu - 4709 - Herding
- hdu 4709 Herding
- HDU 4709 Herding
- HDU 4709 Herding
- HDU - 4709 Herding