其他分享
首页 > 其他分享> > Cupboard and Balloons CodeForces - 342C

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;
}

标签:Cupboard,int,double,CodeForces,ans,342C,Balloons
来源: https://www.cnblogs.com/Cnxz/p/12567129.html