HDU 4709 Herding
来源:互联网 发布:淘宝店铺分类链接 编辑:程序博客网 时间:2024/05/16 07:42
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4709
思路:求最小的三角形面积,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 0x3f3f3f3ftypedef 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 acm
- 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
- iPhone开发中图像处理相关要点
- 转载-Const,Const函数,Const变量,函数后面的Const
- [C++面试题]之面向对象
- 近期计划
- MySql 链接url 参数详解
- HDU 4709 Herding
- hdu(4715) Difference Between Primes
- 统计二进制数字中1的个数
- 对加强for循环的感悟
- iOS后台播放背景音乐文件
- hive表信息,以及查看数据的些
- 利用POI技术把excel数据导入mysql
- gearman杂谈
- 二、计算机的基本组成