链接

物理渣只能搜题解了。。

分三种情况

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. HDU 3078:Network(LCA之tarjan)

    http://acm.hdu.edu.cn/showproblem.php?pid=3078 题意:给出n个点n-1条边m个询问,每个点有个权值,询问中有k,u,v,当k = 0的情况是将u的权值修改 ...

  2. java面向对象学习笔记

    1.内部类 //外部类HelloWorld public class HelloWorld{ //外部类的私有属性name private String name = "imooc" ...

  3. c语言中各个类型的sizeof长度

    #include <stdio.h> int main() {     printf("\nA Char is %lu bytes", sizeof( char )); ...

  4. Oracle导出的sql执行出错

    建的表如果有constraint的话sql语句中会有create unique index...而在前面的建表语句中,这个index实际上已经建好了. 所以导出的sql语句,应该将后面的create ...

  5. javaScript去除空格或换行

    js 去掉空格.回车.换行 1 releaseDesc = releaseDesc.replace(/\ +/g,"").replace(/[\r\n]/g,"" ...

  6. windows tomcat配置大全

    Tomcat下JSP.Servlet和JavaBean环境的配置 第一步:下载j2sdk和tomcat:到sun官方站点()下载j2sdk,注意下载版本为Windows Offline Install ...

  7. H - Solve this interesting problem 分类: 比赛 2015-07-29 21:06 15人阅读 评论(0) 收藏

    Have you learned something about segment tree? If not, don't worry, I will explain it for you.  Segm ...

  8. Design T-Shirt 分类: HDU 2015-06-26 11:58 7人阅读 评论(0) 收藏

    Design T-Shirt Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) T ...

  9. JAVA基础知识之Collections工具类

    排序操作 Collections提供以下方法对List进行排序操作 void reverse(List list):反转 void shuffle(List list),随机排序 void sort( ...

  10. java web简单权限管理设计

    一套最基本的权限管理包括用户.角色.资源. 数据库设计 我的设计如下: 用户:user 角色:role 用户-角色:user_role 资源:resource(包括上级菜单.子菜单.按钮等资源) 角色 ...