Cupboard and Balloons CodeForces - 342C

Cupboard and Balloons

 CodeForces - 342C 

找到不变的点 抓住不确定的点进行讨论

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    double r,h;
    cin>>r>>h;
    int ans;
    ans=2*int(h/r);
    double s=h-int(h/r)*r;
    if(s<r/2.0) ++ans;
    else if(s>=r/2.0&&s<sqrt(3.0)/2.0*r) ans+=2;
    else ans+=3;
    cout<<ans;
}

posted @ 2020-03-25 16:44  John-C  阅读(208)  评论(0编辑  收藏  举报