链接

物理渣只能搜题解了。。

分三种情况

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. aspnet excel导入导出SQLserver

    http://my.csdn.net/libin690145955/code/detail/452 http://blog.csdn.net/ltoper/article/details/532980 ...

  2. Java对象转xml报文和xml报文转Java对象帮助类

    import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marsha ...

  3. miniUI子窗口调父窗口方法

    window.Owner.XXX 其中XXX是父窗口里的方法名

  4. Java学习之路(五)

    1:补充: 使用super也可以调用父类的成员函数  格式 :  super.函数名(); 2:抽象类与抽象函数 抽象函数的定义: 只有函数的定义,没有函数体的函数被称为抽象函数 抽象类的定义: 使用 ...

  5. UVa 213,World Finals 1991,信息解码

    题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  6. PoJ(2263),Floyd,最小值中的最大值

    题目链接:http://poj.org/problem?id=2263 题意:题中给出相连通不同城市之间的载货量,要求找到一条从指定起点到终点的路径,并满足载货量最大. #include <io ...

  7. 检索 COM 类工厂中 CLSID 为 {} 的组件时失败,原因是出现以下错误: 80070005

    检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80070005.跟踪了一下,结果是将记录导出 ...

  8. 邮箱性质--全选单选的操作和传值 用属性的name传值

    封装类 using System; using System.Collections.Generic; using System.Web; /// <summary> /// Ha 的摘要 ...

  9. python学习笔记五 模块上(基础篇)

    模块学习 模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要 ...

  10. poj3349

    http://poj.org/problem?id=3349 每个雪花都有六个分支,用六个整数代表,这六个整数是从任意一个分支开始,朝顺时针或逆时针方向遍历得到的.输入多个雪花,判断是否有形状一致的雪 ...