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. mysql 生成指定范围随机数

    生成随机数 生成0-3的随机数 SELECT RAND() * 3 最大不会超过3, SELECT FLOOR(RAND() * 3) 上面生成整数的值是0,1,2,3生成的随机整数是1,2,3的话, ...

  2. JDBC第一个案例

    1.概述 JDBC(Java DataBase Connectivity) 是 Java 提供的用于执行 SQL 语句一套 API,可以为多种关系型数据库提供统一访问,由一套用 Java 语言编写的类 ...

  3. kubernetes第六章--如何访问pod

  4. 怎样用 vue-i18n这个结合vue的$t来实现通过data传值的翻译

    <el-row class="searchForm"> <template v-for="(item,index) in searchConfig&qu ...

  5. mysql 设置局域网内可访问

    今天同事要连我电脑的数据库   我以为只要127.0.0.1 可以访问就是 运行通过ip访问的... 然而并不是..这里记录下方法 1.打开命令行   进入你电脑的 mysql的bin 目录下 mys ...

  6. input里面的提示文字修改(placeholder里的文字修改,el-input也适用)

    input::-webkit-input-placeholder { /* WebKit browsers */ color: red; } input:-moz-placeholder { /* M ...

  7. vuex页面刷新数据丢失的解决办法

    在vue项目中用vuex来做全局的状态管理, 发现当刷新网页后,保存在vuex实例store里的数据会丢失. 原因: 因为store里的数据是保存在运行内存中的,当页面刷新时,页面会重新加载vue实例 ...

  8. js 数组的深度拷贝 的四种实现方法

    首先声明本人资质尚浅,本文只用于个人总结.如有错误,欢迎指正.共同提高. --------------------------------------------------------------- ...

  9. Oracle数据库 常用SQL

    -- 查询所有数据 SELECT * FROM [TABLE_NAME]; -- 查询数据总量 SELECT COUNT(*) AS COUNT FROM [TABLE_NAME]; -- 清空表内所 ...

  10. HTML&CSS基础-样式的继承

    HTML&CSS基础-样式的继承 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.HTML源代码 <!DOCTYPE html> <html> & ...