链接

物理渣只能搜题解了。。

分三种情况

1、len>=a+b+c

2、len<内切圆半径 圆的面积是最大的 --》以len为周长的圆

3、看这篇http://blog.sina.com.cn/s/blog_6a46cc3f0100tujn.html

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
#define N 100000
#define LL long long
#define INF 0xfffffff
const double eps = 1e-;
const double pi = acos(-1.0);
const double inf = ~0u>>;
int dcmp(double x)
{
if(fabs(x)<eps) return ;
else return x<?-:;
}
int main()
{
double a,b,c,l;
int kk = ;
while(scanf("%lf%lf%lf%lf",&a,&b,&c,&l)!=EOF)
{
if(fabs(a)<eps&&fabs(b)<eps&&fabs(c)<eps&&fabs(l)<eps) break;
double p = (a+b+c)/;
double area = sqrt(p*(p-a)*(p-b)*(p-c));
double r = sqrt((p-a)*(p-b)*(p-c)/p);
double ans ;
if(dcmp(*pi*r-l)>=)
{
ans = l*l/(*pi);
//cout<<"2"<<endl;
}
else if(dcmp(l-a-b-c)>=)
{
ans = area;
//cout<<"1"<<endl;
}
else
{
double k = (a+b+c-l)/(a+b+c-*pi*r);
r*=k;
ans = area-area*k*k+pi*r*r;
// cout<<"3"<<endl;
}
printf("Case %d: %.2f\n",++kk,ans);
}
return ;
}

poj1927Area in Triangle的更多相关文章

  1. [LeetCode] Triangle 三角形

    Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...

  2. [LeetCode] Pascal's Triangle II 杨辉三角之二

    Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3, ...

  3. [LeetCode] Pascal's Triangle 杨辉三角

    Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Retur ...

  4. 【leetcode】Pascal's Triangle II

    题目简述: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Retur ...

  5. 【leetcode】Pascal's Triangle

    题目简述: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5 ...

  6. POJ 1163 The Triangle(简单动态规划)

    http://poj.org/problem?id=1163 The Triangle Time Limit: 1000MS   Memory Limit: 10000K Total Submissi ...

  7. Triangle - Delaunay Triangulator

    Triangle - Delaunay Triangulator  eryar@163.com Abstract. Triangle is a 2D quality mesh generator an ...

  8. LeetCode 118 Pascal's Triangle

    Problem: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows  ...

  9. LeetCode 119 Pascal's Triangle II

    Problem: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Ret ...

随机推荐

  1. SQL中char、varchar、nvarchar的区别

    char    char是定长的,也就是当你输入的字符小于你指定的数目时,char(8),你输入的字符小于8时,它会再后面补空值.当你输入的字符大于指定的数时,它会截取超出的字符.   nvarcha ...

  2. ActiveMQ 安装异常

    解决方式: 1.确认计算机主机名名称没有下划线: 2.如果是win7,停止ICS(运行-->services.msc找到Internet Connection Sharing (ICS)服务,改 ...

  3. C#:将子Form加入父Form中

    实现的功能:已建立了多个子Form界面,在父Form界面左面,点击不同标题的链接文本,父Form界面右面显示不同的子界面内容. 具体如下: 1.加入split拆分器控件 2.在splitControl ...

  4. css弹性盒子学习

    css3弹性盒子是一种布局方式,在适应不同的屏幕大小的时候,能够确保元素拥有更恰当的排布行为.它只是视觉呈现上的,即显示顺序适应显示空间,与源代码无关,源代码顺序不受影响. 定义一个弹性盒子: 在cs ...

  5. 杭电1019-Least Common Multiple

    #include<stdio.h>int gcd(int a,int b);int main(){    int n,m,a,b,i,sum;//sum是最小公倍数    scanf(&q ...

  6. GPS定位原理

    多分钟吧(有人认为美国对其本土覆盖的GPS信号实行不同码率因此纯GPS定位也会很快,谁有美国朋友不妨让他拔卡试试)!因为美版机型其GPS模块的数据处理软件部分与欧版机型是不同的,欧版机型的数据处理软件 ...

  7. Python学习笔记-Day3-python内置函数

    python内置函数 1.abs    求绝对值 2.all 判断迭代器中的所有数据是否都为true 如果可迭代的数据的所有数据都为true或可迭代的数据为空,返回True.否则返回False 3.a ...

  8. centos 6.5源码编译安装subversion 1.8.10

    一.简介 CentOS 6.5的yum源可以安装的SVN客户端版本太低了,1.6.11,所以需要升级到1.8.10,而官网有没有找到1.8.10的安装包,只能选择源码编译安装. 二.安装步骤 参考官网 ...

  9. Windows系统端口占用情况检查脚本

    写了一段检查Windows下端口占用情况的脚本,代码如下: function checkPid($result,$port){ $port = $port.split(":")[1 ...

  10. Intellij IDEA svn的使用记录

    这里的忽略一直灰色的,可以进入 这里的版本控制里进行忽略选择 或者 这里进行添加 这里有三个选择 按照顺序 1.忽略指定的文件 2.忽略文件夹下所有文件 3.忽略符合匹配规则的文件 到Commit C ...