链接

物理渣只能搜题解了。。

分三种情况

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. 使用Jil序列化JSON提升Asp.net web api 性能

    JSON序列化无疑是Asp.net web api 里面性能提升最重要的一环. 在Asp.net web api 里面我们可以插入自定义的MediaTypeFormatter(媒体格式化器), 说白了 ...

  2. 完整学习git二 git 暂存区

    1 git log 命令查看提交日志信息 git log --pretty-fuller #详细查看 git log --stat #查看每次提交的文件变更 git log --pretty-onli ...

  3. 用canvas画时钟

    效果图在博客首页上. html: <canvas id="canvas" >Your browser does not support canvas</canva ...

  4. 开源数据库连接池proxool

    可以根据自己的实际情况,选择不同的配置,可以选择properties.XML.Servlet等配置,官方网站上都有介绍.   1.下载proxool 地址:http://proxool.sourcef ...

  5. android异步加载图片并缓存到本地实现方法

    图片过多造成内存溢出,这个是最不容易解决的,要想一些好的缓存策略,比如大图片使用LRU缓存策略或懒加载缓存策略.今天首先介绍一下本地缓存图片     在android项目中访问网络图片是非常普遍性的事 ...

  6. java关于StringBuffer和StringBuilder写入文件的效率问题

    StringBuffer在存储字符的时候,是有上限的,一旦达到上线就会出错,自己在项目中遇到一个从数据库中查询数据,然后写入到本地文件中 ,数据量大概有30万条,此时的效率十分的低.下面是大致的模拟该 ...

  7. 山东理工大学第七届ACM校赛-飞花的线代 分类: 比赛 2015-06-26 10:29 10人阅读 评论(0) 收藏

    飞花的线代 Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 飞花壕的线代一直非常的壕(好),线代考试每次都是全班第一.一次,飞花壕在预习 ...

  8. muduo库安装

    一.简介 Muduo(木铎)是基于 Reactor 模式的网络库. 二.安装 从github库下载源码安装:https://github.com/chenshuo/muduo muduo依赖了很多的库 ...

  9. reactjs入门到实战(十)----one-first_app

    index <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <!-- ...

  10. VS2010常用快捷键

    ctrl + K, ctrl + F 自动调整格式(选中内容) F12 转到定义 ctrl + F12 转到声明 ctrl + tab 文档窗口转换(下一个文档窗口) alt + F6 下一个面板窗口 ...