Cupboard and Balloons CodeForces - 342C
Cupboard and Balloons
找到不变的点 抓住不确定的点进行讨论
#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 and Balloons CodeForces - 342C的更多相关文章
- codeforces 342C Cupboard and Balloons(公式题)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud C. Cupboard and Balloons A girl named Xen ...
- Codeforces Round #199 (Div. 2) C. Cupboard and Balloons
C. Cupboard and Balloons time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
- CodeForces 342C Cupboard and Balloons (几何问题)
题意:给定一个 r 和 h,r 是上面那个半球的半径,h 是下面那个圆柱的高度,然后有一些半径为 r/2的气球,问你最多能放几个. 析:根据题意,很容易知道,先从下面往上放,两个两个的放,放到不能放的 ...
- cf C. Cupboard and Balloons
http://codeforces.com/contest/342/problem/C #include <cstdio> #include <cstring> #includ ...
- E. Vanya and Balloons Codeforces Round #355 (Div. 2)
http://codeforces.com/contest/677/problem/E 题意:有n*n矩形,每个格子有一个值(0.1.2.3),你可以在矩形里画一个十字(‘+’形或‘x’形),十字的四 ...
- AC日记——Andryusha and Colored Balloons codeforces 780c
C - Andryusha and Colored Balloons 思路: 水题: 代码: #include <cstdio> #include <cstring> #inc ...
- [CF342C]Cupboard and Balloons 题解
前言 博主太弱了 题解 这道题目是一个简单的贪心. 首先毋庸置疑,柜子的下半部分是要放满的. 于是我们很容易想到,分以下三种情况考虑: \[\small\text{请不要盗图,如需使用联系博主}\] ...
- CodeForces Round
CodeForces Round 199 Div2 完了,这次做扯了,做的时候有点发烧,居然只做出来一道题,差点被绿. My submissions # When Who Problem ...
- CodeForces Round 199 Div2
完了,这次做扯了,做的时候有点发烧,居然只做出来一道题,差点被绿. My submissions # When Who Problem Lang Verdict Time Memory 443 ...
- Codeforces Round #199 (Div. 2)
A.Xenia and Divisors 题意:给定N个数,每个数的取值范围为1-7,N是3的倍数,判定是否能够恰好将N个数分成若干三元组,使得一个组中的元素a,b,c满足 a < b < ...
随机推荐
- iPhone添加节假日日历地址
添加苹果节假日日历地址 手动订阅节假日: 打开"设置">"日历">"帐户">"添加帐户">&qu ...
- python官方文档:https://pypi.org/
https://pypi.org/ Find, install and publish Python packages with the Python Package Index
- linux 源码安装 xrdp
前言xrdp可以做两件事,第一件事就是可以使得linux支持RDP协议,使得linux桌面能够通过mstsc连接,第二件事就是RDP代理,我们能通过xrdp连接到其他人的RDP资源 前者,需要编译xr ...
- PHP_工厂模式
实例化类,先需要引入类文件,但是有时候我们并不知道可能要用到那些类,如果将所有类文件全部引入,会造成资源浪费,这时候可以采用工厂模式,专门用于 自动加载.实例化 类. 实例代码: 注:案例中假设有一个 ...
- C# RSA加密解密 签名实现
class RSACryptoItem { public RSACryptoServiceProvider Provider; public List<byte> PubKeyBytes; ...
- JavaScript 时间的操作
1. 标准日期格式 转 时间戳 第一步,设置一个标准日期,获取这个日期格式的时间戳 let timeStr = "2020-08-10 12:34:45"; let newTime ...
- shell_Day05
交互输入 read Python中用input()函数,进行输入: read命令同时可以定义多个变量值:而输入的内容默认以空格为分隔符,将值输入到对应的变量中: 如果默认值过多,最后所有的值都会 ...
- PY3多继承
__author__ = "Alex Li"class A: def __init__(self): print("A")class B(A): pass #d ...
- unity简单物理系统
目录 技术概述 技术详述 2D物理系统组件 刚体 碰撞器 物理材质 碰撞检测函数 在主角中的使用 移动 长跳跃与短跳跃 二段跳 攀爬(蹬墙跳) 技术使用中遇到的问题和解决过程 技术概述 物理系统,就是 ...
- ubuntu20.04开机自动运行脚本实例
在 Ubuntu 20.04 中,/etc/rc.local 文件仍然存在,但不再默认启用,因为它已经被 systemd 代替.下面是使用systemd开机执行的脚本的实例: 1.编写脚本myscri ...