Area in Triangle
Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 1674   Accepted: 821

Description

Given a triangle field and a rope of a certain length (Figure-1), you are required to use the rope to enclose a region within the field and make the region as large as possible. 

Input

The input has several sets of test data. Each set is one line containing four numbers separated by a space. The first three indicate the lengths of the edges of the triangle field, and the fourth is the length of the rope. Each of the four numbers have exactly four digits after the decimal point. The line containing four zeros ends the input and should not be processed. You can assume each of the edges are not longer than 100.0000 and the length of the rope is not longer than the perimeter of the field.

Output

Output one line for each case in the following format:

Case i: X

Where i is the case number, and X is the largest area which is rounded to two digits after the decimal point.

Sample Input

12.0000 23.0000 17.0000 40.0000
84.0000 35.0000 91.0000 210.0000
100.0000 100.0000 100.0000 181.3800
0 0 0 0

Sample Output

Case 1: 89.35
Case 2: 1470.00
Case 3: 2618.00 第三种情况:摘的别人的图

//数学一本通习题 2
//POJ 1927 求三角形内周长一定的图形的最大面积 //题意:给定一个三角形的三边长和一根绳子的长度,问将绳子放在三角形里能围起来的最大面积是多少 //余弦定理:
//cosA=b^2+c^2-a^2/2*bc
//cosB=a^2+c^2-b^2/2*ac
//cosC=a^2+b^2-c^2/2*ab //三角形面积公式
//S=0.5*bc*sinA=0.5*bc*(1-cosA^2)
//三角形内接圆半径:
//r=2S/(a+b+c) //如果绳子够长,长度>=三角形周长的话,那么能围成的最大面积就是三角形的面积
//如果绳子长度<=三角形内切圆周长的话,那么最大面积就是把绳子围成一个圆的面积(因为等周长的平面图形一定圆的面积最大,大概是初中学的)
//。如果介于两者中间呢?
//那就自己看blog去
//求出相似比
//xsb=(C-d)/(C-2*PI*R) #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std; const double PI=acos(-1.0);
const double eps=1e-; double a,b,c,d; int dcmp(double x)
{
return x<-eps?-:x>eps;
} int main()
{
int cas=;
while(scanf("%lf%lf%lf%lf",&a,&b,&c,&d))
{
if(!dcmp(a)&&!dcmp(b)&&!dcmp(c)&&!dcmp(d))
break;
++cas;
double C=a+b+c;
double cosA=(b*b+c*c-a*a)/(*b*c);
double S=0.5*b*c*sqrt(-cosA*cosA);
double R=S*/C;
if(d>=C) //直接围三角形
printf("Case %d: %.2lf\n",cas,S);
else if(d<=*PI*R) //绳子长度<=内切圆周长,围个圆
printf("Case %d: %.2lf\n",cas,d*d/(*PI));
else //看blog去
{
double xsb=(C-d)/(C-*PI*R); //相似比
double r=R*xsb;
printf("Case %d: %.2lf\n",cas,S-S*xsb*xsb+PI*r*r);
}
}
return ;
}
												

POJ 1927 Area in Triangle的更多相关文章

  1. POJ 1927 Area in Triangle(计算几何)

    Area in Triangle 博客原文地址:http://blog.csdn.net/xuechelingxiao/article/details/40707691 题目大意: 给你一个三角形的三 ...

  2. POJ 1927 Area in Triangle 题解

    link Description 给出三角形三边长,给出绳长,问绳在三角形内能围成的最大面积.保证绳长 \(\le\) 三角形周长. Solution 首先我们得知道,三角形的内切圆半径就是三角形面积 ...

  3. poj 1654 Area 多边形面积

    /* poj 1654 Area 多边形面积 题目意思很简单,但是1000000的point开不了 */ #include<stdio.h> #include<math.h> ...

  4. poj 1265 Area 面积+多边形内点数

    Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5861   Accepted: 2612 Description ...

  5. POJ 1265 Area POJ 2954 Triangle Pick定理

    Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5227   Accepted: 2342 Description ...

  6. POJ1927 Area in Triangle

      Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1458   Accepted: 759 Description Give ...

  7. poj 1265 Area (Pick定理+求面积)

    链接:http://poj.org/problem?id=1265 Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions:  ...

  8. poj 1654 Area (多边形求面积)

    链接:http://poj.org/problem?id=1654 Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions:  ...

  9. poj 1265 Area( pick 定理 )

    题目:http://poj.org/problem?id=1265 题意:已知机器人行走步数及每一步的坐标   变化量 ,求机器人所走路径围成的多边形的面积.多边形边上和内部的点的数量. 思路:1.以 ...

随机推荐

  1. go语言学习笔记----模拟实现文件拷贝函数

    实例1 //main package main import ( "bufio" "flag" "fmt" "io" & ...

  2. unbuntu 16.04 MS-Celeb-1M + alexnet + pytorch

    最近被保研的事情搞的头大,拖了半天才勉强算结束这个了.从熟悉unbantu 16.04的环境(搭个翻墙的梯子都搞了一上午 呸!)到搭建python,pytorch环境.然后花了一个上午熟悉py的基本语 ...

  3. webRTC client 源码环境工具配置

    以下操作真实实验过,安卓,苹果均可成功 环境 Mac 10.13.6 Xcode 11 翻墙代理:Lantern 专业版 Python 2.7.10 设置 git 代理 #设置git代理 $ git ...

  4. javascript高级程序设计阅读总结

    5章 引用类型 1.object类型 创建 1.var obj ={} ---对象字面量 2.var obj = new Object(); ---new操作符 2.Array类型 创建 1.var ...

  5. element-ui 穿梭框使用axios数据查询

    //class="input"样式自写,用来覆盖穿梭框自带的搜索,它自带的搜索框不能搜索外部数据,只能查询在穿梭框内的数据 <div style="text-ali ...

  6. 实战OpenGLES--iOS平台使用OpenGLES渲染YUV图片

    上一篇文章 实战FFmpeg--iOS平台使用FFmpeg将视频文件转换为YUV文件 演示了如何将视频文件转换为yuv文件保存,现在要做的是如何将yuv文件利用OpenGLES渲染展示出图像画面.要将 ...

  7. iview 标题内边距过大; 调整iview 单元格内边距、行高;

    1css代码: /*调整table cell间隔和行高*/ .ivu-table-cell { padding-left: 1px; padding-right: 1px; } .ivu-table- ...

  8. Kubernetes-使用Helm安装istio

    添加istio库: helm repo add istio.io https://storage.googleapis.com/istio-release/releases/1.3.4/charts/ ...

  9. Flink原理(五)——容错机制

    本文是博主阅读Flink官方文档以及<Flink基础教程>后结合自己理解所写,若有表达有误的地方欢迎大伙留言指出. 1.  前言 流式计算分为有状态和无状态两种情况,所谓状态就是计算过程中 ...

  10. SonarQube中三种类型的代码规则

    https://www.cnblogs.com/guoguochong/p/9117829.html 1.概述SonarQube(sonar)是一个 开源 平台,用于 管理 源代码的 质量 . Son ...