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. Web App和Native App 谁将是未来

    未来是Web App的天下,还是Native App的天下?作为设计师,我们是应该努力把客户端的体验提升到最优,还是在网页应用层面上做更多的设计?这个一直是大家关心的话题.那么,我们首先应该立体的认识 ...

  2. 免费WiFi,仅仅为好久没联系的你们

    昨日,认识五年的朋友搬来与我一起住了,说不上来,没有激动,仅仅是突然感觉生活又多了一点生机.兴致上来,晚上立马联系了已经近四个月没有联系的好友,才知道他们的生活也因这几个月发生了翻天覆地的变化.究竟什 ...

  3. 《sqlite权威指南》读书笔记 (一)

    一 常量 字符串常量   (使用单引号括住.如果常量中有单引号,使用两个单引号来表示.大小写敏感) 数字常量 二进制常量 二 关键字 关键字大小写不敏感 三 注释 单行注释使用 --XXXXXXX 多 ...

  4. [io PWA] Great libraries and tools for great Progressive Web Apps

    sw-toolbox: Github It provides a cononical implementation of all the runtime caching strategies that ...

  5. 教你搞定Android自定义View

    Android App开发过程中,很多时候会遇到系统框架中提供的控件无法满足我们产品的设计需求,那么这时候我们可以选择先Google下有没有比较成熟的开源项目可以让我们用,当然现在Github上面的项 ...

  6. android 37 线程通信Looper

    安卓程序的主线程也叫UI线程. 工作线程和主线程的差别:安卓主线程已经调用了Looper.prepare()方法了,已经有一个MessageQueue对象了,所以才可以在工作线程用Handler发消息 ...

  7. Windows如何打包Qt程序

    很多Qt爱好者想发布自己的Qt软件,但却发现在其他没有安装Qt SDK的机器上无法运行,这就是本文想要说明的问题.现在网上大部分软件都要发布自己开发的应用程序,都会打包到exe文件中,待安装完exe文 ...

  8. Java 理论与实践: 非阻塞算法简介--转载

    在不只一个线程访问一个互斥的变量时,所有线程都必须使用同步,否则就可能会发生一些非常糟糕的事情.Java 语言中主要的同步手段就是synchronized 关键字(也称为内在锁),它强制实行互斥,确保 ...

  9. dedecms 5.7文章编辑器附件上传图标不显示

    我最近发现在使用dedecms 5.7文章编辑器附件上传图标不显示了,以前是没有问题的,这个更新系统就出来问题了,下面我来给大家分享此问题解决办法.   问题bug:在dedecms 5.7中发现了一 ...

  10. js数组操作的常用方法

    数组:arr=[1,2,3,4,5]; 1.数组转换成字符串,不会修改原数组内容: arr.join(); // "1,2,3,4,5" arr.join("" ...