链接

物理渣只能搜题解了。。

分三种情况

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. Greenplum的全量恢复之gpdbrestore

    gpdbrestore命令是对gp_restore命令的一个包装,提供了更灵活的选项,比如,使用gpcrondump自动备份的文件来恢复.使用gpdbrestore恢复必须具备: 1. 存在gpcro ...

  2. sass初步认识1

    sass是一种“css预处理器”,同类的还有less等,方法类似.css预处理器的基本思想是,用一种专门的编程语言,进行网页样式设计,然后再编译成正常的css文件. 使用sass需要先暗转RUBY,再 ...

  3. python day6 面向对象

    把一个类变成具体的实例化的过程叫做类 实例化:把一个类变成一个具体对象的过程 __init__  构造函数,在实例化时初始化数据 __init__方法的第一个参数永远是self,表示创建的实例本身,因 ...

  4. Coco2dx 3D例子

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18     // add "HelloWorld" splash screen"   ...

  5. 水流雨渍shader

    战神斯巴达之魂的雨渍做的很逼真,尝试了下,似乎是差不多了,整体欠缺不少 普通平面: 环形流动: 河流: shader实现,3层加上一个偏移层 圆形的雨渍流动和河流要重新展一下UV

  6. TCP三次握手

      TCP协议下,客户的和服务器的连接过程称为“三次握手”   第一次握手:建立连接时,客户的发送SYN包到服务器,并进入SYN_SEND状态,等待服务器确认. 第二次握手:服务器收到SYN包,必须确 ...

  7. Java Cryptography Extension (JCE): 放开Java加密算法密钥最大长度16的限制

    1. 在官网下载JCE: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads- ...

  8. hdu So Easy!

    So Easy! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Su ...

  9. #pragma 的使用

    #pragma 的使用 尽管 C 和 C++ 都已经有标准,但是几乎每个编译器 (广义,包含连接器等) 扩展一些 C/C++ 关键字. 合理地应用这些关键字,有时候能使我们的工作非常方便.下面随便说说 ...

  10. Apache+Tomcat+mod_jk负载均衡

    一.需要的软件 1.jdk1.5以上 2.Tomcat6以上 3.Apache2.2以上 ,地址http://apache.dataguru.cn//httpd/binaries/win32/ ,名称 ...