cf C. Cupboard and Balloons
http://codeforces.com/contest/342/problem/C
1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 using namespace std; 6 7 __int64 r,h; 8 9 int main() 10 { 11 while(scanf("%I64d%I64d",&r,&h)!=EOF) 12 { 13 __int64 t2=(h/r)*2; 14 if((h%r)*2<r) t2++; 15 else if((h%r)*2>=sqrt(3.0)*r) t2+=3; 16 else t2+=2; 17 printf("%I64d\n",t2); 18 } 19 return 0; 20 }