本文主要是介绍cf 342C - Cupboard and Balloons(计算几何),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
很简单的几何问题,,,
橱子上方球的放置有三种情况。。3个,2个,1个,,,
代码如下:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>#define M 100005
#define eps 1e-8
#define INF 0x7fffffffusing namespace std;int main ()
{int h, r;scanf("%d%d", &r, &h);int ans = h/r*2;double yy = h-h/r*r;if(yy>=sqrt(3.0)*0.5*r) ans += 3;else if(yy >= 0.5*r) ans+=2;else ans += 1;printf("%d\n",ans);return 0;
}
这篇关于cf 342C - Cupboard and Balloons(计算几何)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!