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

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

Source

数学问题 计算几何

(物理题?)

画图太麻烦了,随便贴个别处的题解吧233 http://blog.csdn.net/xuechelingxiao/article/details/40707691

没加case傻傻WA了两次

 /*by SilverN*/
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
const int mxn=;
int read(){
int x=,f=;char ch=getchar();
while(ch<'' || ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>='' && ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
double a,b,c,d;
inline double Sin(double a,double b,double c){
double Cos=(a*a+b*b-c*c)/(*a*b);
return sqrt(-Cos*Cos);
}
double calc(double a,double b,double c,double d){
double Pi=acos(-1.0);
double S=0.5*a*b*Sin(a,b,c);
if(d-(a+b+c)>=){return S;}
double h=S*/(a+b+c);
if(h**Pi>=d){return d*d//Pi;}
double Len=a+b+c;
double T=(Len-d)/(Len-*Pi*h);
return S-S*T*T+(h*T)*(h*T)*Pi;
}
int main(){
int i,j,cas=;
while(scanf("%lf%lf%lf%lf",&a,&b,&c,&d)!=EOF){
if(a== && b== && c== && d==)break;
printf("Case %d: %.2f\n",++cas,calc(a,b,c,d));
}
return ;
}

POJ1927 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

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

  3. hdu 1451 Area in Triangle(计算几何 三角形)

    Given a triangle field and a rope of a certain length (Figure-1), you are required to use the rope t ...

  4. Area in Triangle /// oj10229

    题目大意: 给出三角形的三个顶点 再给一条绳(绳长不超过三角形周长) 求绳子在三角形中能围出的最大面积 题解链接 http://blog.sina.com.cn/s/blog_6a46cc3f0100 ...

  5. POJ 1927 Area in Triangle 题解

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

  6. UVa 11437:Triangle Fun(计算几何综合应用,求直线交点,向量运算,求三角形面积)

    Problem ATriangle Fun Input: Standard Input Output: Standard Output In the picture below you can see ...

  7. zoj 1010 Area【线段相交问题】

    链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1010 http://acm.hust.edu.cn/vjudge/ ...

  8. Triangle 1.6 (A Two-Dimensional Quality Mesh Generator and Delaunay Triangulator)

    Triangle 一个二维高质量网格(mesh)生成器和Delaunay三角化工具. PSLG(Planar Straight Line Graph)约束Delaunay三角网(CDT)与Delaun ...

  9. [ZJU 1010] Area

    ZOJ Problem Set - 1010 Area Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Jer ...

随机推荐

  1. css3 横向拖拽

    css: .tab{         list-style-type: none;         display:-webkit-box;         display:-webkit-flex; ...

  2. javascript简易日历制作

    学习记录 01.练习数组的用法 02.理解this.index的用法 03.绑定事件深入练习理解 html代码 <div id="date"> <ul id=&q ...

  3. linux批量替换

    sed -i "s/李三/李四/g"  -r result/*       将result文件夹下的所有文件中的李三替换成李四 sed命令下批量替换文件内容  格式: sed -i ...

  4. 662. Maximum Width of Binary Tree

    https://leetcode.com/problems/maximum-width-of-binary-tree/description/ /** * Definition for a binar ...

  5. ICSharpCode.SharpZipLib.dll

    using ICSharpCode.SharpZipLib.Checksums; using ICSharpCode.SharpZipLib.Zip; namespace { /// <summ ...

  6. 水题:HDU-1088-Write a simple HTML Browser(模拟题)

    解题心得: 1.仔细读题,细心细心...... 2.题的几个要求:超过八十个字符换一行,<br>换行,<hr>打印一个分割线,最后打印一个新的空行.主要是输出要求比较多. 3. ...

  7. HDU 6153 KMP

    最终刷KMP目标就是为了挑战这道题!现在成功了恩... 首先,题目大意是:给出一个字符串str1,之后给出另一个字符串str2,问,str2的后缀在str1匹配的次数*后缀当前长度是多少 首先考虑正统 ...

  8. Harbor HA部署-使用Ceph RADOS后端

    1. 前言 Harbor 1.4.0版本开始提供了HA部署方式,和非HA的主要区别就是把有状态的服务分离出来,使用外部集群,而不是运行在本地的容器上.而无状态的服务则可以部署在多个节点上,通过配置上层 ...

  9. UVa 1455 Kingdom 线段树 并查集

    题意: 平面上有\(n\)个点,有一种操作和一种查询: \(road \, A \, B\):在\(a\),\(b\)两点之间加一条边 \(line C\):询问直线\(y=C\)经过的连通分量的个数 ...

  10. loj2090 「ZJOI2016」旅行者

    分治+最短路,很套路的 #include <algorithm> #include <iostream> #include <cstring> #include & ...