CF342C.Cupboard and Balloons

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle with base r and height h + r from the sides. The figure below shows what the cupboard looks like (the front view is on the left, the side view is on the right).

Xenia got lots of balloons for her birthday. The girl hates the mess, so she wants to store the balloons in the cupboard. Luckily, each balloon is a sphere with radius . Help Xenia calculate the maximum number of balloons she can put in her cupboard.

You can say that a balloon is in the cupboard if you can't see any part of the balloon on the left or right view. The balloons in the cupboard can touch each other. It is not allowed to squeeze the balloons or deform them in any way. You can assume that the cupboard's walls are negligibly thin.

一个名叫克谢尼娅(Xenia)的女孩有一个壁橱,从正面看呈弧形。该弧形由一个半径为 rr 的半圆(壁橱顶部)和两个高度为 hh 的竖直侧壁(壁橱两侧)组成。壁橱的深度为 rr,即从侧面看,它呈现为一个底边长为 rr、高为 h+rh + r 的矩形。下图展示了该壁橱的外观(左侧为正视图,右侧为侧视图)。

克谢尼娅生日时收到了许多气球。她讨厌杂乱,因此想把这些气球都收纳进壁橱里。幸运的是,每个气球都是一个半径为 的球体。请帮助克谢尼娅计算她最多能在壁橱中放入多少个气球。

我们称一个气球位于壁橱内,当且仅当在左视图或右视图中均看不到该气球的任何部分。壁橱内的气球可以相互接触,但不允许挤压或以任何方式形变气球。可假设壁橱的壁厚忽略不计。

输入格式

The single line contains two integers r, h (1 ≤ r, h ≤ 107).

单行包含两个整数 rr、hh(1≤r,h≤1071 \leq r, h \leq 10^7)。

输出格式

Print a single integer — the maximum number of balloons Xenia can put in the cupboard.

输出一个整数——Xenia 能放入橱柜的气球的最大数量。

输入输出样例

  • 输入#1

    1 1

    输出#1

    3
  • 输入#2

    1 2

    输出#2

    5
  • 输入#3

    2 1

    输出#3

    2

输入解题思路,AI测评打分。不知道怎么写?

首页