ZOJ 3147 Dezider's Coverup【最小圆覆盖】【模板题】

镜像电流源与比例电流源:原理、应用与性能优化 本文深入解析了镜像电流源与比例电流源的工作原理、核心应用与性能优化方法。镜像电流源利用匹配晶体管实现电流复制,是集成电路的基础;比例电流源通过发射极电阻实现电流缩放,应用更灵活。文章重点探讨了其作为有源负载提升放大器增益的关键应用,并分析了静态误差、输出阻抗和最小工作电压三大性能指标,最后介绍了威尔逊电流镜等进阶优化技术及实战设计要点。 阅读详情

Dezider's Coverup

Time Limit: 1 Second      Memory Limit: 32768 KB

Zlatica to his house for dinner. The trouble is, he tripped with the sauce in his hands (thankfully this was in the morning and Zlatica did not see it) and many bright red droplets fell on his white carpet. Now Dezider is starting to panic because he wants to have a perfectly clean house to impress Zlatica. Fortunately, there is a store nearby which sells all sizes of (expensive) circular rugs. Dezider does not have much money so he wants to buy the smallest rug with an integer radius which will cover all the droplets. You need to write a program to help him determine the right size to buy.

Input

Each test cases starts with one positive integer n, the number of droplets on the carpet. Each of the following n lines contains two floating-point numbers, separated by white space, which represent the x- and y-coordinate of the corresponding droplet.

Output

One line for each test case which consists of a single integer, the radius of the smallest circular rug needed to cover all the droplets.

Sample Input

4
1 -0.5
1.5 0
0.5 0.5
1 0.5

Sample Output

1

because a circular rug of radius 1 and center for example at 1,0 will cover the four droplets described by the input.


#include <stdio.h>
#include <math.h>
const int maxn=1005;
const double eps=1e-9;
struct point
{
    double x, y;
    point operator-(point & tp)
    {
        point rp;
        rp.x=x-tp.x;
        rp.y=y-tp.y;
        return rp;
    }
}p[maxn];
struct circle
{
    double r;
    point centre;
}c;
struct tripoint
{
    point t[3];
};
double dis(point a, point b)
{
    a=a-b;
    return sqrt(a.x * a.x + a.y * a.y);
}
double triangleArea(tripoint t)
{
    point p1, p2;
    p1=t.t[1]-t.t[0];
    p2=t.t[2]-t.t[0];
    return fabs(p1.x*p2.y-p1.y*p2.x)/2;
}
circle circumcircleOfTriangle(tripoint t)
{    //三角形的外接圆
    circle tmp;
    double a, b, c, c1, c2;
    double xA, yA, xB, yB, xC, yC;
    a=dis(t.t[0], t.t[1]);
    b=dis(t.t[1], t.t[2]);
    c=dis(t.t[2], t.t[0]);    //根据S = a * b * c / R / 4;求半径R
    tmp.r=a*b*c/triangleArea(t)/4;
    xA=t.t[0].x;
    yA=t.t[0].y;
    xB=t.t[1].x;
    yB=t.t[1].y;
    xC=t.t[2].x;
    yC=t.t[2].y;
    c1=(xA*xA+yA*yA-xB*xB-yB*yB)/2;
    c2=(xA*xA+yA*yA-xC*xC-yC*yC)/2;
    tmp.centre.x=(c1*(yA-yC)-c2*(yA-yB))/((xA-xB)*(yA-yC)-(xA-xC)*(yA-yB));
    tmp.centre.y=(c1*(xA-xC)-c2*(xA-xB))/((yA-yB)*(xA-xC)-(yA-yC)*(xA-xB));
    return tmp;
}
circle MinCircle2(int tce, tripoint ce)
{
    circle tmp;
    if(tce==0)
        tmp.r=-2;
    else if(tce==1)
    {
        tmp.centre=ce.t[0];
        tmp.r=0;
    }
    else if(tce==2)
    {
        tmp.r=dis(ce.t[0], ce.t[1])/2;
        tmp.centre.x=(ce.t[0].x+ce.t[1].x)/2;
        tmp.centre.y=(ce.t[0].y+ce.t[1].y)/2;
    }
    else if(tce==3)
        tmp=circumcircleOfTriangle(ce);
    return tmp;
}
void MinCircle(int t, int tce, tripoint ce)
{
    int i, j;
    point tmp;
    c=MinCircle2(tce, ce);
    if(tce==3) return;
    for(i=1; i<=t; i++)
    {
        if(dis(p[i], c.centre)>c.r)
        {
            ce.t[tce]=p[i];
            MinCircle(i-1, tce+1, ce);
            tmp=p[i];
            for(j=i; j>=2; j--)
                p[j]=p[j-1];
            p[1]=tmp;
        }
    }
}
int main()
{
    int n,i;
    while(~scanf("%d", &n) && n)
    {
        for(i=1; i<=n; i++)
            scanf("%lf%lf", &p[i].x, &p[i].y);
        tripoint ce;
        MinCircle(n, 0, ce);
        int x=(int)c.r;
        if(c.r-x<eps)
        {
            printf("%d\n",x);
        }
        else printf("%d\n",x+1);
    }
    return 0;
}







【Unity】【2D】用连续图片生成动画Animation的简明步骤 本文介绍了Unity中使用2D连续图片制作2D动画Animation的简明步骤。 阅读详情

相关推荐

VSCode里玩转AvaloniaUI:手把手教你搭建跨平台桌面应用开发环境(附.NET 7配置避坑)

本文详细介绍了如何在VSCode中搭建AvaloniaUI跨平台桌面应用开发环境,包括.NET 7配置避坑指南。从环境准备、项目创建到调试优化,手把手教你利用VSCode和Avalonia实现高效开发,特别解决了.NET 7依赖等常见问题,助力开发者快速上手跨平台应用开发。

weixin_28826545的博客 578

点集的最小圆覆盖

包含点集所有点的最小圆的算法最小圆覆盖 http://acm.zju.edu.cn/show_problem.php?pid=1450 相关题目最小球包含 http://acm.pku.edu.cn/JudgeOnline/problem?id=2069 平面上有n个点,给定

° ﹎.- 看淡1.苆х. 1349

deepseek本地部署及应用部署指南

如果你找到的日志是[send] via NET/IB/0,则表示网络通信是通过IB网络的,但是没有开启GDRDMA技术,则会有大致5%的性能损耗(网传,未实测)。新增的环境变量配置,主要用于启用IB网络通信,而非使用以太网进行通信,详细的每一个参数的具体含义,可以在英伟达NCCL的官方网站上找到说明。下一步,我会对已经完成部署的模型进行压测,来探索系统的性能极限在哪里,以及如何在生产环境中何如进行进一步的性能优化,期待你的关注。

weixin_39797121的博客 2624

【最小圆覆盖 模板】HDU - 3007 C - Buried memory

C - Buried memory HDU - 3007  Problem Description Each person had do something foolish along with his or her growth.But,when he or she did this that time,they could not predict that this thing is a ...

qq_41037114的博客 373

【电击防护篇】电击防护技术详解:从人体效应到接地系统全解析

本文系统讲解了电击防护的关键知识,包括电流对人体的影响(如30mA是心室颤动阈值)、人体电阻特性(700Ω-6100Ω)以及电气接触防护措施。重点分析了TT、TN和IT三大接地系统的结构特点与应用场景,强调TN-S系统最安全,IT系统供电连续性最佳。详细介绍了漏电保护器(RCD)的工作原理与选型指南,建议人身防护选用30mA高灵敏度RCD。文章通过对比表总结三大系统的安全性、成本及适用场景,为电气安全设计提供实用参考。

2301_81299416的博客 1744

基于YOLOv11的工业零件表面缺陷检测系统:从原理到实现

工业质量控制是制造业的核心环节,表面缺陷检测作为其中重要组成部分,直接关系到产品质量和企业效益。本文详细介绍了一种基于YOLOv11深度学习算法的工业零件表面缺陷检测系统,包含完整的算法原理分析、数据集构建方法、模型训练策略以及用户界面设计。通过大量实验验证,该系统能够高效准确地检测零件表面的划痕、凹陷、锈蚀等多种缺陷,检测精度达到96.2%,满足工业实时检测需求。本文还提供了完整的代码实现和详细的技术文档,为相关领域的研究者和工程师提供参考。关键词:表面缺陷检测;YOLOv11;深度学习;工业视觉;

YOLO 567

最小圆覆盖——模板题

#include const int maxn = 1005; struct TPoint { double x, y; TPoint operator - (const TPoint &a) const { TPoint p1; p1.x = x - a.x; p1.y = y - a.y; return p1; } }; struct TCircle { doubl

Tczxw的专栏 560

SwinTransformer 改进:SSPCAB模块(2024最新改进方法)

SSPCAB(Spatial Pyramid Pooling with Channel Attention Block)是2024年提出的一种新型神经网络架构改进方法,专注于在保持高精度的同时显著降低计算复杂度和参数量。该方法通过创新的空间金字塔池化与通道注意力机制的结合,实现了网络结构的紧凑化和运算效率的大幅提升。核心创新点1. 混合空间金字塔池化(Hybrid Spatial Pyramid Pooling, HSPP)多尺度动态核池化:根据输入特征图尺寸动态调整池化核大小和步长交叉级联结构。

Henry的博客 1310

列出空间中的圆面上的点

列出空间中的圆面上的点 问题: 在一个世界坐标系中,已知空间一圆面区域的圆心位置和法向量,求该圆面上的点在世界坐标系下的表示,点集合。 思路: 1、先以世界坐标系原点为圆的圆心,根据给定的圆半径在x-o-y平面上将圆面上的点都写出来,一个点集合。 2、根据空间中圆心坐标和法向量,求出齐次旋转变换矩阵,将原点处的点集的店经过齐次变换得到空间中的点集。 具体实现: 第一个的问题描述类似这个连接力说...

weixin_42040046的博客 1383

2026年北京君正数字IC笔试试卷带答案

本文摘要:该文档是一份数字IC设计相关的考试试题,包含单选题、多选题、波形分析题和代码设计题。内容涵盖时序约束、半导体工艺、状态机设计、逻辑综合、异步FIFO设计等知识点。试题解析详细,重点考察数字电路基础、时序分析和Verilog代码实现能力。典型题目包括多周期路径设置、Moore/Mealy状态机区别、同步复位与异步复位特性、RISC-V架构特点等,并提供了异步FIFO的Verilog实现参考代码。(149字)

Open 113

深度学习笔记——Transformer

本文详细介绍面试过程中可能遇到的Transformer知识点。

haopinglianlian的博客 1706

POJ 3461 Oulipo【KMP】【模板题】(找出第一个字符串在第二个字符串中出现次数)

Oulipo Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 42886   Accepted: 17234 Description The French author Georges Perec (1936–1982) once wrote a book, L

雲泥有別 尘亦生辉 1007

YOLOv8改进策略【卷积层】| GnConv:一种通过门控卷积和递归设计来实现高效、可扩展、平移等变的高阶空间交互操作

HorNet: 利用递归门控卷积实现高效高阶空间交互GnConv(Recursive Gated Convolution,递归门控卷积)

Limiiiing的博客 324

2017"百度之星"程序设计大赛 - 初赛(A)1001——HDU 6108【求因子数】【思维题】

小C的倍数问题    Accepts: 1990    Submissions: 4931  Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description 根据小学数学的知识,我们知道一个正整数x是3的倍数的

雲泥有別 尘亦生辉 743

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

HDU 6114 Chess【逆元+组合数】【模板题】

Chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 95    Accepted Submission(s): 72 Problem Description 車是中国象棋中的一种棋子,它能攻击同一行或同一列

雲泥有別 尘亦生辉 700

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

HDU 6181 Two Paths【次短路】【模板题】

Two Paths Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 153428/153428 K (Java/Others) Total Submission(s): 236    Accepted Submission(s): 138 Problem Description You are given a

雲泥有別 尘亦生辉 690

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

ZOJ 2996 (1+x)^n【模板题】【常用技巧】

(1+x)^n Time Limit: 2 Seconds      Memory Limit: 65536 KB Please calculate the coefficient modulo 2 of x^i in (1+x)^n. Input For each case, there are two integers n, i (0 Output For each c

雲泥有別 尘亦生辉 654

ZOJ 3058 Circle and Ring【圆与环相交面积】【圆与圆相交面积模板】

Circle and Ring Time Limit: 1 Second      Memory Limit: 32768 KB Given a circle and a ring, your task is to calculate the area of their intersection. Input This problem contains multiple tes

雲泥有別 尘亦生辉 621

HDU 2844 Coins[【经典题】【模板题】

Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 15971    Accepted Submission(s): 6340 Problem Description Whuacmers use coins

雲泥有別 尘亦生辉 614

HDU 4081 Qin Shi Huang's National Road System【次小生成树】【模板题】

Qin Shi Huang's National Road System Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8054    Accepted Submission(s): 2869 Problem Desc

雲泥有別 尘亦生辉 592

HDU 3037 Saving Beans【Lucas定理】【模板题】【模板】【组合数取余】

Saving Beans Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5775    Accepted Submission(s): 2320 Problem Description Although wint

雲泥有別 尘亦生辉 538

HDU1698 Just a Hook(成段更新)【模板】

题目链接 Just a HookTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 32198 Accepted Submission(s): 15831Problem Description In the game of DotA

雲泥有別 尘亦生辉 515

POJ 3974 Palindrome【manacher】【模板题】【模板】

Palindrome Time Limit: 15000MS   Memory Limit: 65536K Total Submissions: 9838   Accepted: 3724 Description Andy the smart computer science student was attending an algo

雲泥有別 尘亦生辉 512
上一篇: CF 590D Top Secret Task【dp递推+滚动数组】【好题】
下一篇: ZOJ 3141 Arnie's Dog Biscuits【dp递推】
Archger
博客等级 码龄10年 79粉丝 137原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值