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

  1. 12.0000 23.0000 17.0000 40.0000
  2. 84.0000 35.0000 91.0000 210.0000
  3. 100.0000 100.0000 100.0000 181.3800
  4. 0 0 0 0

Sample Output

  1. Case 1: 89.35
  2. Case 2: 1470.00
  3. Case 3: 2618.00

Source

数学问题 计算几何

(物理题?)

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

没加case傻傻WA了两次

  1. /*by SilverN*/
  2. #include<algorithm>
  3. #include<iostream>
  4. #include<cstring>
  5. #include<cstdio>
  6. #include<cmath>
  7. #include<vector>
  8. using namespace std;
  9. const int mxn=;
  10. int read(){
  11. int x=,f=;char ch=getchar();
  12. while(ch<'' || ch>''){if(ch=='-')f=-;ch=getchar();}
  13. while(ch>='' && ch<=''){x=x*+ch-'';ch=getchar();}
  14. return x*f;
  15. }
  16. double a,b,c,d;
  17. inline double Sin(double a,double b,double c){
  18. double Cos=(a*a+b*b-c*c)/(*a*b);
  19. return sqrt(-Cos*Cos);
  20. }
  21. double calc(double a,double b,double c,double d){
  22. double Pi=acos(-1.0);
  23. double S=0.5*a*b*Sin(a,b,c);
  24. if(d-(a+b+c)>=){return S;}
  25. double h=S*/(a+b+c);
  26. if(h**Pi>=d){return d*d//Pi;}
  27. double Len=a+b+c;
  28. double T=(Len-d)/(Len-*Pi*h);
  29. return S-S*T*T+(h*T)*(h*T)*Pi;
  30. }
  31. int main(){
  32. int i,j,cas=;
  33. while(scanf("%lf%lf%lf%lf",&a,&b,&c,&d)!=EOF){
  34. if(a== && b== && c== && d==)break;
  35. printf("Case %d: %.2f\n",++cas,calc(a,b,c,d));
  36. }
  37. return ;
  38. }

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. C++ 限定名称查找

    限定名称查找规则实际归纳下来很简单,先对::左边的名称进行查找(遵循,限定,无限定),然后在左边查找到的(此时只查找类型名称)名字的作用域内(含内联名称空间件)查找右边出现的名字,查找到即存在(故可以 ...

  2. Java读取各种文件格式内容

    所需的jar包哦也不要太记得了,大家可以搜搜,直接上代码: import java.io.BufferedInputStream; import java.io.File; import java.i ...

  3. Java,集合按自定义规则排序

    import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.u ...

  4. 通用后台管理系统源码,响应式布局,Java管理系统源码,零门槛安装部署

    本项目是一个通用响应式管理后台,导入开发环境安装就能直接运行,界面也非诚漂亮,在PC端和移动端也是自适应的.非常适合企业或者个人搭建各种商城后台,博客后台,网站管理后台等. 源码启动后的截图 需要这套 ...

  5. JZOJ 3462. 【NOIP2013模拟联考5】休息(rest)

    3462. [NOIP2013模拟联考5]休息(rest) (Standard IO) Time Limits: 1000 ms  Memory Limits: 262144 KB  Detailed ...

  6. php中 为什么验证码 必须要开启 ob_clean 才可以显示

    用ob_clean(),将前面的输出都清除就OK了 这表示你的程序前面有输出,<?php 前有空格.空行.文件有BOM头 ob_clean(); header("content-typ ...

  7. Python学习笔记(三):文件和集合操作

    python string与list互转 因为python的read和write方法的操作对象都是string.而操作二进制的时候会把string转换成list进行解析,解析后重新写入文件的时候,还得 ...

  8. Jane Austen【简·奥斯汀】

    Jane Austen Jane Austen, a famous English writer, was born at Steventon, Hampshire, on December 16, ...

  9. Linux命令之---cd

    命令简介 Linux cd 命令是Linux中最基本的命令语句,其他的命令语句要进行操作,都是建立在使用 cd 命令上的. 命令格式 cd [目录名] 命令功能 切换当前目录至dirName 常用范例 ...

  10. Python基础闯关失败总结

    对列表进行创建切片增删改查 对列表进行创建 L1 = []  # 定义L1 为一个空列表 List() #创建List 空列表 对列表进行查询 L2 = ['a','b','c','d','a','e ...