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. backpropagation algorithm

    搞卷积神经网络的时候突然发现自己不清楚神经网络怎么训练了,满脸黑线,借此机会复习一下把. 首先放一位知乎大佬的解释.https://www.zhihu.com/question/27239198?rf ...

  2. 支持移动端裁剪图片插件Jcrop(结合WebUploader上传)

    (此教程包括前端实现图片裁剪,后端进行获取裁剪区并保存) 最近有一个需求,微信公众号上传图片,支持自定义裁剪. 以前用过一款裁剪插件cropper,很久没用了,不知道对移动端操作兼容如何,重新从网上搜 ...

  3. django-nginx与uwsgi项目部署

    uwsgi是提供动态服务的 nginx反向代理 在项目中创建一个settings.py的副本.我这里重命名为copy_settings.py,将配置文件中的DEBUG=False 修改项目下wsgi. ...

  4. vue 关于子组件向父组件传值$emit触发无效问题

    先贴上代码 子组件代码 //子组件请求接口,用自己封装的axios getupdate(){ this.$post({ url:this.$apis.unitupdate, postType:'jso ...

  5. PHP 结合 Bootstrap 实现学生列表以及添加学生功能实现(继上篇登录及注册功能之后)

    本人是一位学生,正在学习当中,可能BUG众多,请见谅并指正,谢谢!!! 学生列表实现 HTML: <!DOCTYPE html> <html> <head> < ...

  6. redux的理解

    Redux 这里介绍下我对Redux的理解,不涉及如何使用Redux. Redux 官网介绍: A predictable state container for JavaScript apps.(一 ...

  7. Appscan漏洞之跨站点请求伪造(CSRF)

    公司前段时间使用了Fortify扫描项目代码,在修复完这些Fortify漏洞后,最近又启用了Appscan对项目代码进行漏洞扫描,同样也是安排了本人对这些漏洞进行修复.现在,针对修复过的Appscan ...

  8. 【MySQL】你以为设置了并行复制就降低延迟了?这个你绝对想不到!

    在MySQL官方版本中,为了保证其的高可用性,一般情况我们会采用主从复制的方式来解决.当然,方法很多.而我们今天所要处理的是采用GTID方式并且开了多线程复制后,仍然延迟的情况,糟糕的是,延迟还在不断 ...

  9. gitlab自带的Nginx与原Nginx冲突的解决方案

    gitlab 推荐方案2 默认情况下,gitlab使用自带的Nginx,占用80端口,这样就与系统原本安装的Nginx冲突.导致其中一个nginx无法启动 我的gitlab可以正常启动,当再部署一个接 ...

  10. Android自动化测试探索(七)代码覆盖率统计

    之前在 https://www.cnblogs.com/zhouxihi/p/11453738.html 这篇写了一种统计Android覆盖率的方式 但是对于一些比较复杂或者代码结构不够规范的项目,有 ...