hrbust1530 pie

立创EDA开源项目:小北极冰冰杯(夏)——基于ESP32-C3的智能半导体制冷杯硬件设计与功能解析 本文详细解析了基于ESP32-C3的智能半导体制冷杯——小北极冰冰杯的硬件设计与核心功能。项目利用半导体制冷片实现快速降温,并集成了PWM智能调速散热、四路温度监控、杯具检测及PD/DC双电源输入等实用功能。文章深入剖析了其硬件架构、控制逻辑及实战注意事项,为嵌入式开发与智能硬件爱好者提供了宝贵的参考。 阅读详情

My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several small pieces since that looks messy. This piece can be one whole pie though. 



My friends are very annoying and if one of them gets a bigger piece than the others, they start complaining. Therefore all of them should get equally sized (but not necessarily equally shaped) pieces, even if this leads to some pie getting spoiled (which is better than spoiling the party). Of course, I want a piece of pie for myself too, and that piece should also be of the same size. 

What is the largest possible piece size all of us can get? All the pies are cylindrical in shape and they all have the same height 1, but the radii of the pies can be different. 
Input
One line with a positive integer: the number of test cases. Then for each test case:
  • One line with two integers N and F with 1 ≤ N, F ≤ 10 000: the number of pies and the number of friends.
  • One line with N integers ri with 1 ≤ ri ≤ 10 000: the radii of the pies.
Output
For each test case, output one line with the largest possible volume V such that me and my friends can all get a pie piece of size V. The answer should be given as a floating point number with an absolute error of at most 10−3. 
Sample Input
3
3 3
4 3 3
1 24
5
10 5
1 4 2 3 4 5 6 5 4 2
Sample Output
25.1327
3.1416
50.2655


题意大概是m+1个人分n个pie,每个人分得的pie只能来自同一个pie。即我可以把一个pie切成几份给别人,但一个人不能收到超过一份pie。

因为我要找一个适当的大小,且可证只有唯一确定的一个大小使得最后每个人分得的最大。故用二分查找,左边界是0,又边界是最大的“面积”,(不是半径)。

最后乘pi,以保证精度。


#include<iostream>
#include<cstdio>
#include<string.h>
#include<math.h>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
using namespace std;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;

const double eps = 1e-8;
const double pi = acos(-1);    //define pi
int n,m;
int s[10000+5] = {0};
bool judge(double mid)
{
    int cnt = 0;
    for(int i=0;i<n;i++){
        if(s[i] >= mid){
            cnt += (int)( s[i]/mid);
        }
    }
    return cnt>=m+1;
}
int main()
{
    int T;
    cin >> T;
    while(T--){
        memset(s,0,sizeof(s));
        int maxs = -1;
        cin >> n >> m;
        for(int i=0;i<n;i++){
            int temp;
            cin >> temp;
            s[i] = temp*temp;
            maxs = max(maxs,s[i]);
        }
        double left =0.0 ,right = maxs*1.0;
        while(left+eps < right){
           double mid = (left+right)/2.0;
            if(judge(mid)){
                left = mid;
            }
            else{
                right = mid;
            }
        }
        cout << fixed << setprecision(4) << left*pi << endl;
    }
}


华三R4900 G5服务器实战:用PMC P460-B4阵列卡配置RAID1+RAID6,并搞定CentOS 7.9安装(含热备盘设置) 本文详细解析了在华三R4900 G5服务器上使用PMC P460-B4阵列卡配置RAID1+RAID6混合阵列的全过程,包括热备盘设置和CentOS 7.9系统安装。通过实战步骤和性能优化建议,帮助企业IT人员高效部署高可用存储方案,特别适合需要数据冗余和系统稳定性的企业级应用场景。 阅读详情

相关推荐

Camera | 瑞芯微rk3568平台MIPI-CSI驱动:从设备树到V4L2框架的完整链路解析

本文深入解析瑞芯微rk3568平台MIPI-CSI驱动的完整链路,从设备树配置到V4L2框架集成。详细介绍了rk3568的MIPI-CSI驱动架构、设备树关键节点布局、驱动初始化流程及数据流路径,帮助开发者快速掌握摄像头控制器的调试与优化技巧,实现稳定的视频采集系统。

weixin_28703489的博客 289

poj 3122 pie

题目意思:我过生日请了f 个朋友来参加我的生日party,m个蛋糕,我要把它平均分给每个人(包括我),并且每个人只能从一块蛋糕得到自己的那一份,并且分得的蛋糕大小要一样,形状可以不一样,每块蛋糕都是圆柱,高度一样。 此题是一个二分题,下限是用最大的分,上限是sum/f+1。中间值是m,当cnt+=cnt+=(int)floor(p[i]/m);cnt Description My bir

hellobabygogo3的专栏 4193

时序约束实战:从setup/hold到时钟路径约束的深度解析

本文深度解析数字设计中的时序约束实战,重点探讨如何从setup/hold检查的核心原理出发,理解并应用时钟路径约束。文章通过剖析Path Requirement的计算逻辑,结合同频、倍频及异步时钟域等典型场景,提供了从解读时序报告到编写、调试SDC约束的系统方法,帮助工程师有效应对复杂SoC设计中的时序收敛挑战。

weixin_29291185的博客 105

POJ 3122 Pie

二分

Orion_Rigel 522

IEDA激活码失效?教你5分钟快速续期的方法

本文针对IEDA激活码失效问题,提供了一套从快速应急到深度排查的完整解决方案。文章不仅详解了5分钟快速续期与清理缓存等应急方法,更深入剖析了授权机制、离线激活流程,并指导如何构建可持续的授权管理策略,帮助开发者彻底解决激活困扰,确保开发环境稳定。

a0b1c2d3的专栏 273

Windows 10下用vcpkg一键搞定libcurl开发环境(Code::Blocks 20.03配置指南)

本文详细介绍了在Windows 10系统下使用vcpkg工具快速配置libcurl开发环境的完整指南,特别针对Code::Blocks 20.03 IDE进行优化设置。通过vcpkg自动化管理依赖项,简化libcurl的安装与配置过程,帮助开发者高效搭建网络通信功能开发环境,并提供了常见问题解决方案和实际项目中的最佳实践。

weixin_28040125的博客 249

Pie

Problem Description My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This shoul

weixin_54501632的博客 336

计算机网络实验——入侵检测系统实验

在图1所示的网络结构中,此方案的具体实施:在路由器Router1的接口1出方向配置入侵检测策略,在收到ICMP ECHO请求包时,丢弃并同步向日志服务器报告警告,此时,终端PC2和PC3无法对终端PC0和PC1执行ping操作,并且日志服务器将记录相应的警告信息;在实验一的基础上,添加扩展分组过滤器,指定需要进行检测的信息流的类别,将扩展分组和对应的入侵检测规则进行绑定,使得只对特定的信息流进行入侵检测。加载指定类别的特征库,这里的指定类别是 ios_ips 类别中的 basic 子类别。

放放的博客 1563

Pie(poj -3122)(二分答案)

题目:http://poj.org/problem?id=3122   My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my frien...

偷吃了老鼠的土豆 2363

生信实战:用bcftools玩转VCF文件处理(从压缩到注释全流程)

本文详细介绍了使用bcftools处理VCF文件的全流程实战指南。从数据准备、压缩索引、信息提取、质量统计到核心的变异过滤与功能注释,手把手教你高效管理基因组变异数据。重点阐述了如何利用bcftools进行VCF文件注释,整合外部数据库信息,为变异位点添加关键的生物学标签,是生物信息学数据分析的必备技能。

rgv23456789的博客 340

【论文学习】《Fully-Convolutional Siamese Networks for Object Tracking》2016年SiamFC 全卷积孪生网络用于目标跟踪

在这项工作中,我们脱离了跟踪中采用的传统在线学习方法,并展示了一种专注于在离线阶段学习强嵌入的替代方法。与在分类设置中的使用不同,我们证明,对于跟踪应用,孪生全卷积深度网络能够更有效地使用可用数据。这不仅反映在测试时,通过执行有效的空间搜索,也反映在训练时,其中每个子窗口都有效地代表一个有用的样本,而几乎没有额外的成本。实验表明,深度嵌入为在线跟踪器提供了自然丰富的特征来源,并使简单的测试时策略表现良好。我们相信这种方法是对更复杂的在线跟踪方法的补充,并期望未来的工作能够更彻底地探索这种关系。

SkyLeopard的博客 2418

HDU 1969(搜索题,二分)

Pie<br />Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 152    Accepted Submission(s): 49<br /><br />Problem DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one

-- bird -- 1228

【ComfyUI】【Nunchaku】【diffusers报错解决】秋叶整合包安装 Nunchaku 报错的解决方法

最近在折腾 AI 绘图时,我尝试在秋叶的 ComfyUI 整合包中安装 `ComfyUI-nunchaku` 插件(版本 0.3.3),结果启动后直接报错,提示无法从 `accelerate.utils.memory` 中导入 `clear_device_cache`,让我一度怀疑插件是否兼容。查阅了一堆 issue 和源码之后,总算找到了原因和解决方法。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 1852

hrbust 1530 Pie(二分)

My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of on

qq_45928501的博客 119

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

HRBUST - 1530

题目 My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each ...

w_m_w_m_w_m_w_m的博客 135

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Pie(贪心+二分)

Pie My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each...

双木林的博客 401

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

Pie(二分答案)

Pie(二分答案) Description: My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This sh

Eagle222的博客 438

题目-My birthday is coming up and traditionally I'm serving pie.

Problem DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my...

二喵君的博客 4148

c语言分蛋糕均匀正方形,分蛋糕(C - 二分查找)

分蛋糕题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=85904#problem/CDescriptionMy birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of ...

weixin_34281501的博客 478

pie 饼子问题

My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of

my dream is possible 477

LA3635 - Pie

My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each

5年Java后端研发,分享个人读书学习笔记。 699

UVALive - 3635 Pie(二分答案查找)

点击打开题目链接 Time limit: 1 second My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a numberNof them, of various tastes and of various sizes.Fof my

Chook_lxk的博客 541

uva12097 Pie

二分答案

YHaX的博客 398

Pie(二分)

2651 - Pie Problem Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends ar...

一身清贫怎敢入繁华 555

POJ-3122 Pie 分蛋糕(二分法)

My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of ...

是小光a~ 419

Pie(HDU1969)

Pie Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 22099Accepted Submission(s): 7551 Problem Description My birthday is coming up and...

代码笔记本 321
上一篇: 泉水 bfs
下一篇: hdu4282 A very hard mathematic problem
mwhybmj
博客等级 码龄10年 8粉丝 74原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值