http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2374

思路:三分枚举。

 #include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#define maxn 1000100
using namespace std;
const double eps=1e-;
const double pi=acos(-1.0); double w,h; double ok(double x,int flag)
{
double max1=;
double k=h;
double s=w;
double r=(x>s)?s:x;
double ss=pi*(r/)*(r/);
double ll=pi*r;
double c=k-x;
double r1=(k-x)>s?s:(k-x);
if(s>=ll&&flag==)
{
double v1=ss*c;
max1=max(max1,v1);
}
if(c>=ll&&flag==)
{
double v2=ss*s;
max1=max(max1,v2);
}
double s1=pi*(r1/)*(r1/);
double l1=pi*r1;
if(s>=l1&&flag==)
{
double v3=s1*x;
max1=max(v3,max1);
}
if(x>=l1&&flag==)
{
double v4=s1*s;
max1=max(max1,v4);
}
return max1;
} int main()
{
while(scanf("%lf%lf",&w,&h)!=EOF)
{
if(w==&&h==) break;
double l=,r=h;
double ans=,ans1=;
while(r-l>eps)
{
double mid1=(r+l)/;
double mid2=(l+mid1)/;
if(ok(mid1,)>=ok(mid2,))
{
ans=mid1;
l=mid2;
}
else
r=mid1;
}
l=,r=w;
while(r-l>eps)
{
double mid1=(r+l)/;
double mid2=(l+mid1)/;
if(ok(mid1,)>=ok(mid2,))
{
ans1=mid1;
l=mid2;
}
else
r=mid1;
}
printf("%.3lf\n",max(ok(ans,),ok(ans1,)));
}
return ;
}

Cylinder的更多相关文章

  1. ZOJ 3866 - Cylinder Candy

    3866 - Cylinder Candy Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu ...

  2. Bleed Brake Master Cylinder with Intelligent Tester IT2

    When the brake fluid level drops too low in the master cylinder reservoir, air bubbles can get caugh ...

  3. FusionWidgets Cylinder图

    1.数据源 Cylinder.xml: <?xml version="1.0" encoding="UTF-8"?> <chart palet ...

  4. Cylinder Candy(积分+体积+表面积+旋转体)

    Cylinder Candy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Edward the confectioner is ...

  5. Cylinder Candy(积分)

    Cylinder Candy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Edward the confectioner is ...

  6. Track Cylinder

    1 Track = 48 KB1 Cylinder = 720 KB so 1 Cylinder = 15 Tracks Read more: http://ibmmainframes.com/abo ...

  7. span-wise drag/lift forces of cylinder

    span-wise drag/lift forces of cylinder SR Description:   Dear Sir/Madam, I am trying to simulate a 3 ...

  8. Global UNIX file system cylinder group cache

    A global cylinder group (CG) cache is stored in file server memory and shared by a plurality of file ...

  9. WPF 3D model - Sphere, Cone, and Cylinder

    原文:WPF 3D model - Sphere, Cone, and Cylinder   Extending Visual3D - Sphere, Cone, and Cylinder http: ...

  10. 以圆类 Circle 及立体图形类 Solid 为基础设计圆柱类 Cylinder

    学习内容:以圆类 Circle 及立体图形类 Solid 为基础设计圆柱类 Cylinder 代码示例: import java.util.Scanner;class Point3{ private ...

随机推荐

  1. docker 查看容器详细

    http://www.docker.org.cn/book/docker/checking-running-image-12.html

  2. muduo网络库使用心得

    上个月看了朋友推荐的mudo网络库,下完代码得知是国内同行的开源作品,甚是敬佩.下了mudo使用手冊和035版的代码看了下结构,感觉是一个比較成熟并且方便使用的网络库.本人手头也有自己的网络库,尽管不 ...

  3. Oracler读取各种格式的相关日期格式

    CREATE OR REPLACE Package Pkg_Stm_Date As     --Purpose:相关日期处理功能包          --获取某一天是第几周     Function ...

  4. 第五篇:python基础之循环结构以及列表

    python基础之循环结构以及列表   python基础之编译器选择,循环结构,列表 本节内容 python IDE的选择 字符串的格式化输出 数据类型 循环结构 列表 简单购物车的编写 1.pyth ...

  5. Python之路【第十七篇】:Django【进阶篇】

    Python之路[第十七篇]:Django[进阶篇 ]   Model 到目前为止,当我们的程序涉及到数据库相关操作时,我们一般都会这么搞: 创建数据库,设计表结构和字段 使用 MySQLdb 来连接 ...

  6. iOS Safari 中点击事件失效的解决办法

    问题描述 当使用委托给一个元素添加click事件时,如果事件是委托到 document 或 body 上,并且委托的元素是默认不可点击的(如 div, span 等),此时 click 事件会失效. ...

  7. CSS Clip剪切元素动画实例

    1.CSS .fixed { position: fixed; width: 90px; height: 90px; background: red; border: 0px solid blue; ...

  8. 使用 logback + slf4j 进行日志记录

    此处主要介绍maven web工程下如何使用 logback + slf4j  进行日志记录. logback主要包含三个组成部分:Loggers(日志记录器).Appenders(输出目的在).La ...

  9. ssh配置事务

    http://blog.csdn.net/jianxin1009/article/details/9202907(不错)

  10. tableView嵌套collectionView

    首先是自定义collectionView填充的tableViewCell import UIKit // 定义一个collectionView,重写初始化大小和布局方法 class TrendsDet ...