cf 342C - Cupboard and Balloons(计算几何)
2013-09-08 16:41
369 查看
很简单的几何问题,,,
橱子上方球的放置有三种情况。。3个,2个,1个,,,
代码如下:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define M 100005
#define eps 1e-8
#define INF 0x7fffffff
using 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;
}
橱子上方球的放置有三种情况。。3个,2个,1个,,,
代码如下:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define M 100005
#define eps 1e-8
#define INF 0x7fffffff
using 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;
}
相关文章推荐
- hdu 4720 Naive and Silly Muggles 外接圆(计算几何) 2013 ACM/ICPC Asia Regional Online —— Warmup2 1005
- Codeforces Round #365 (Div. 2) C. Chris and Road(计算几何+二分)
- cf#Wunder Fund Round 2016 -C - Constellation-计算几何-水题
- ZOJ 1608 Two Circles and a Rectangle(简单计算几何)
- CF 333E 计算几何+bitset优化
- HDU 4720 Naive and Silly Muggles(计算几何)
- CodeFroces342 C. Cupboard and Balloons
- poj1981 Circle and Points 计算几何
- HDU-2857-Mirror and Light(计算几何)
- Codeforces Round #339 (Div. 1) A. Peter and Snow Blower 计算几何
- JOJ 2109 && POJ 1981 Circle and Points 计算几何 单位圆覆盖问题
- cf C. Cupboard and Balloons
- CF 342C(Cupboard and Balloons-难得对的贪心)
- POJ1981 Circle and Points(计算几何)
- 山东省第五届ACM省赛题——angry_birds_again_and_again(计算几何)
- Codeforces 32E Hide-and-Seek 乞讨2关于镜面反射点 计算几何
- Codeforces Round #199 (Div. 2) -- C. Cupboard and Balloons (数学)
- Codeforces Round #199 (Div. 2) C. Cupboard and Balloons
- ZOJ - 3806 Incircle and Circumcircle(计算几何+二分)
- 【Codeforces Round 330 (Div 2)D】【计算几何 二分答案】Max and Bike 最小骑车距离使得圆上传感器很坐标位移为dis