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. 深度优先搜索(DFS)思路及算法分析

    1.算法用途: 用于遍历图中的节点,有些类似于树的深度优先遍历.这里唯一的问题是,与树不同,图形可能包含循环,因此我们可能会再次来到同一节点. 2.主要思想: 借用一个邻接表和布尔类型数组(判断一个点 ...

  2. JavaNetty

    Netty的简单使用: import io.netty.bootstrap.Bootstrap; import io.netty.buffer.Unpooled; import io.netty.ch ...

  3. SpringBoot与整合其他技术

    SpringBoot与整合其他技术 5.1 SpringBoot整合Mybatis 5.1.1 添加Mybatis的起步依赖 <!--mybatis起步依赖--> <dependen ...

  4. VS 引用dll版本冲突问题

    1.删除项目中的对应引用: 2.如果是有用到NetGet引用的删除项目中的packages里面的对应包文件: 3.如果是在NetGet中引用的注释项目中packages.config对应的插件名: 4 ...

  5. docker第一章--介绍和安装

  6. react之高阶组件(二)

    高阶组件的使用 接上文———— 一.像函数一样直接调用 import React, { Component } from 'react' import A from './A' class C ext ...

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

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

  8. 谈一谈做iOS播放器库开发所涉及的知识点

    在自己研究生毕业的时候,想着能找上一份做视频编解码的工作,可惜没有如愿,最后到了一家iOS游戏渠道公司去做游戏支付业务的SDK开发,我的iOS正式开发生涯就这么开始了. 在那家iOS游戏渠道没做上一年 ...

  9. Map转url ,url转Map工具类

    /** * 将url参数转换成map * @param param aa=11&bb=22&cc=33 * @return */ public static Map<String ...

  10. sublime的package control的中文镜像

    参加: http://packagecontrol.cn/installation