Codeforces Round #199 (Div. 2)C. Cupboard and Balloons

2020-09-28 10:45:27 浏览数 (1)

C. Cupboard and Balloons

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Input

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

Output

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

Examples

input

Copy

代码语言:javascript复制
1 1

output

Copy

代码语言:javascript复制
3

input

Copy

代码语言:javascript复制
1 2

output

Copy

代码语言:javascript复制
5

input

Copy

代码语言:javascript复制
2 1

output

Copy

代码语言:javascript复制
2

思路:分为两种情况。见几何画板的图

代码语言:javascript复制
// luogu-judger-enable-o2
#include<bits/stdc  .h>
#include<unordered_set>
#define rg register ll
#define inf 2147483647
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
#define ll long long
#define maxn 200005
const double eps = 1e-6;
using namespace std;
inline ll read()
{
	char ch = getchar(); ll s = 0, w = 1;
	while (ch < 48 || ch>57) { if (ch == '-')w = -1; ch = getchar(); }
	while (ch >= 48 && ch <= 57) { s = (s << 1)   (s << 3)   (ch ^ 48); ch = getchar(); }
	return s * w;
}
inline void write(ll x)
{
	if (x < 0)putchar('-'), x = -x;
	if (x > 9)write(x / 10);
	putchar(x % 10   48);
}
double r,h;
int main()
{
    cin>>r>>h;
    cout<<max((ll)(2 2*(h-r/2.0)/r),1 2*(ll)((h r*(1-0.5*sqrt(3)))/r))<<endl;
    return 0;
}

0 人点赞