专栏首页C语言及其他语言【每日一题】问题 1111: Cylinder

【每日一题】问题 1111: Cylinder

关注最新赛事,比赛详细,有意思的程序段子就点击上方蓝字关注我们吧~

题目描述

Using a sheet of paper and scissors, you can cut out two faces to form a cylinder in the following way: Cut the paper horizontally (parallel to the shorter side) to get two rectangular parts. From the first part, cut out a circle of maximum radius. The circle will form the bottom of the cylinder. Roll the second part up in such a way that it has a perimeter of equal length with the circle's circumference, and attach one end of the roll to the circle. Note that the roll may have some overlapping parts in order to get the required length of the perimeter. Given the dimensions of the sheet of paper, can you calculate the biggest possible volume of a cylinder which can be constructed using the procedure described above?

输入

The input consists of several test cases. Each test case consists of two numbers w and h (1 ≤ w ≤ h ≤ 100), which indicate the width and height of the sheet of paper. The last test case is followed by a line containing two zeros.

输出

For each test case, print one line with the biggest possible volume of the cylinder. Round this number to 3 places after the decimal point.

样例输入

10 10 10 50 10 30 0 0

样例输出

54.247 785.398 412.095

本文分享自微信公众号 - 编程范(dotcpp)

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2018-12-13

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 手游后台PVP系统网络同步方案总结

    来源:游迅网 发布者:wuyu 概述   PVP系统俨然成为现在新手游的上线标配,手游Pvp系统体验是否优秀,很大程度上决定了游戏的品质。从最近半年上线的新...

    编程范 源代码公司
  • 如何到达C语言的巅峰?我推荐你阅读《C语言小白变怪兽》!

    《C语言小白变怪兽》融入了作者 8 年的编程功力,以及文学级的写作能力,耗时 5 年完成,期间经过了 5 次大改版。

    编程范 源代码公司
  • [蓝桥杯]Hello, world!

    题目描述 This is the first problem for test. Since all we know the ASCII code, your ...

    编程范 源代码公司
  • CodeForces 24D Broken robot (概率DP)

    D. Broken robot time limit per test 2 seconds memory limit per test 256 me...

    ShenduCC
  • What is PCA ?

    figure cited here, recommend reading: A step by step explanation of Principal Co...

    杨熹
  • Knapsack problem algorithms for my real-life carry-on knapsack

    I'm a nomad and live out of one carry-on bag. This means that the total weight o...

    李海彬
  • TCN v2 + 3Dconv 运动信息

    https://sites.google.com/view/actionablerepresentations

    用户1908973
  • pytorch-pretrained-BERT:BERT PyTorch实现,可加载Google BERT预训练模型

    Github上刚刚开源了一个Google BERT的PyTorch实现版本,同时包含可加载Google BERT预训练模型的脚本,感兴趣的同学可以关注:

    AINLP
  • 记录一次Stack上关于“数学之美”的brainstorm

    math.stackexchange.com是stackExchange上一个和数学有关的论坛, 有点类似我们的贴吧, 当然质量肯定不可相提并论的.

    Jean
  • C. NEKO's Maze Game

    time limit per test:1.5 seconds memory limit per test:256 megabytes inputstandar...

    某些人

扫码关注云+社区

领取腾讯云代金券