往一个由半圆和长方形组成的盒子里放气球。
重点考虑顶部那部分,放一个,两个,还是三个。计算一下能放下三个的极限情况就可以了。
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<iomanip>
#include<stdlib.h>
#include<ctype.h>
#include<algorithm>
#include<deque>
#include<functional>
#include<iterator>
#include<vector>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#define CPY(A, B) memcpy(A, B, sizeof(A))
typedef long long LL;
typedef unsigned long long uLL;
const int MOD = int (1e9) + 7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double OO = 1e20;
const double PI = acos (-1.0);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
int main() {
double r,h;
while (cin>>r>>h) {
int ans= (int) (h/r) *2;
h-= (int) ans*r/2;
if (h>=r/2) { ans+=2; h-=r; }
h+= (2-sqrt (3) ) *r/2;
if (h>=0) { ans++; }
cout<<ans<<endl;
}
return 0;
}