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. jwt 0.9.0 系列目录

    jwt官网地址:https://jwt.io/ PS: 写此系列的时候,jjwt jar包版本是0.9.0 <dependency>    <groupId>io.jsonwe ...

  2. python3+requests:post请求四种传送正文方式

    https://www.cnblogs.com/insane-Mr-Li/p/9145152.html 前言:post请求我在python接口自动化2-发送post请求详解(二)已经讲过一部分了,主要 ...

  3. SQL Server 索引优化 ——索引缺失

    本文我们将重点给出动态视图法发现数据库中缺失的索引.对于索引的调整和新建将不在本文阐述范围,后续将陆续分享相关经验. sys.dm_db_missing_index_details 缺失索引明细,包括 ...

  4. Harbor 企业级私有仓库 Ubuntu16.04 搭建及使用

    一.Harbor简介 1.1.什么是Harbor 几个VMware中国的人搞了一个容器镜像仓库.Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器. 1.2.Harbor架 ...

  5. python-django中的APPEND_SLASH实现

    关于django中的APPEND_SLASH APPEND_SLASH 它是啥? 看变量名大概能知道做什么,就是添加斜线,用路由系统那里. 路由文件,只写了路由关系代码 ...... urlpatte ...

  6. js数据类型及判断数据类型

    众所周知,js有7种数据类型 1. null 2. undefined 3. boolean 4. number 5. string 6. 引用类型(object.array.function) 7. ...

  7. TweenMax—ScrambleText插件 实现类似电脑破译密码的特效

    首先贴一下TweenMax的中文网:https://www.tweenmax.com.cn/ 首先先展示一下最后的效果,需要的就继续看下去: 那团乱码是会一直变的 那么如何实现上图的效果呢??? 其实 ...

  8. ..\USER\stm32f10x.h(428): error: #67: expected a "}" ADC1_2_IRQn = 18, /*!

    MDK软件编译,出现如下错误: ..\USER\stm32f10x.h(428): error: #67: expected a "}" ADC1_2_IRQn = 18, /*! ...

  9. CentOS7.x安装Java

    1.在甲骨文注册帐号下载需要版本的java的源码包 https://www.oracle.com/java/technologies/jdk12-downloads.html 2.把下载好的jdk的源 ...

  10. Alternative method of unlocking the bootloader - without code from HUAWEI

    原文:https://forum.xda-developers.com/p8lite/general/alternative-method-unlocking-bootloader-t3799294 ...