传送门

题意:在平面中,有一个圆,有一个点,问能在这个圆中围出最大的圆的圆心坐标和半径。要求这个最大圆不包含这个点。

思路:比较基础的计算几何,要分三种情况,第一种就是这个点在圆外的情况。第二种是点在圆内。第三种是这个点和圆心重合。

ac代码

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <cstring>
  5. #include <string>
  6. #include <vector>
  7. #include <map>
  8. #include <set>
  9. #include <queue>
  10. #include <list>
  11. #include <iterator>
  12. #include <cmath>
  13. using namespace std;
  14.  
  15. #define lson (l , mid , rt << 1)
  16. #define rson (mid + 1 , r , rt << 1 | 1)
  17. #define debug(x) cerr << #x << " = " << x << "\n";
  18. #define pb push_back
  19. #define pq priority_queue
  20.  
  21. #define Pll pair<ll,ll>
  22. #define Pii pair<int,int>
  23.  
  24. #define fi first
  25. #define se second
  26.  
  27. #define OKC ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
  28. typedef long long ll;
  29. typedef unsigned long long ull;
  30. const double espp = 0.0000000001;
  31.  
  32. /*-----------------show time----------------*/
  33. double R,x,y,x2,y2;
  34. double dis(double a,double b,double x,double y)
  35. {
  36. return sqrt((a-x)*(a-x) + (b-y)*(b-y));
  37. }
  38. int main(){
  39. scanf("%lf%lf%lf%lf%lf", &R, &x, &y, &x2, &y2);
  40. double d = dis(x,y,x2,y2);
  41.  
  42. if(d > R ||abs(d-R) < espp)
  43. {
  44. printf("%lf %lf %lf\n",x,y,R);
  45. }
  46. else
  47. {
  48. double r1 = (R + d)/;
  49. double dx = 1.0*(x-x2)*(x-x2) + 1.0*(y-y2)*(y-y2);
  50. dx = sqrt(dx);
  51. double ans1,ans2;
  52. if(dx!=)
  53. {
  54. ans1 = x2 + (x-x2)/dx*r1;
  55. ans2 = y2 + (y-y2)/dx*r1;
  56. }
  57. else
  58. {
  59. ans1 = x;
  60. ans2 = y+R/;
  61. }
  62. printf("%.9lf %.9lf %.9lf\n",ans1,ans2,r1);
  63. }
  64.  
  65. return ;
  66. }

CF935C

Codeforces Round #465 &935C. Fifa and Fafa计算几何的更多相关文章

  1. 【Codeforces Round #465 (Div. 2) C】Fifa and Fafa

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 这个x2,y2和圆心(x1,y1)相连.形成的直线和圆交于点(x3,y3) 则(x2,y2)和(x3,y3)的中点就是所求圆的圆心. ...

  2. [Codeforces Round #340 (Div. 2)]

    [Codeforces Round #340 (Div. 2)] vp了一场cf..(打不了深夜的场啊!!) A.Elephant 水题,直接贪心,能用5步走5步. B.Chocolate 乘法原理计 ...

  3. Codeforces Round #198 (Div. 2)A,B题解

    Codeforces Round #198 (Div. 2) 昨天看到奋斗群的群赛,好奇的去做了一下, 大概花了3个小时Ak,我大概可以退役了吧 那下面来稍微总结一下 A. The Wall Iahu ...

  4. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  5. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  6. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  7. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  8. Codeforces Round #279 (Div. 2) ABCDE

    Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/outpu ...

  9. Codeforces Round #262 (Div. 2) 1003

    Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...

随机推荐

  1. 微信小程序登陆流程图时序图

    微信小程序登录 小程序可以通过微信官方提供的登录能力方便地获取微信提供的用户身份标识,快速建立小程序内的用户体系. 微信小程序登录流程时序图 说明 调用 wx.login() 获取 临时登录凭证cod ...

  2. 显示Mac隐藏文件的命令:

    设置查看隐藏文件的方法如下:打开终端,输入命名 显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles -bool true 隐藏 ...

  3. 【Python-Django】Jinja2模板引擎配置教程详解!!!!

    Jinjia2的官方文档:http://jinja.pocoo.org/docs/2.10/ 1. 安装Jinja2扩展包 $ pip install Jinja2 2. 配置Jinja2模板引擎 T ...

  4. DesignPattern系列__02接口隔离原则

    介绍 客户端不应该依赖它不需要的接口,即一个类对另一个类的依赖应该建立在最小接口上. Demo引入 先来看一张图: interface MyInterface { void operation1(); ...

  5. 上手mongodb

    上手MongoDB MongoDB 是一个跨平台的,面向文档的数据库,如果你了解spring-data-jpa的使用, 那么恭喜你,你已经可以使用mongodb做开发了 使用这种类型的数据库还是挺方便 ...

  6. 直击根源:微信小程序中web-view再次刷新后页面需要退两次

    背景 在上一章(直击根源:vue项目微信小程序页面跳转web-view不刷新)解决了vue在小程序回退不刷新的问题之后,会引出了一个刷新的页面需要点击返回两次才能返回上一个页面 问题描述 在A页面从B ...

  7. (十三)c#Winform自定义控件-导航菜单

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...

  8. MBR和EFI启动过程

    MBR启动过程 BIOS-->MBR(主引导记录)-->DPT(硬盘分区表)-->DBR(分区引导扇区)-->BootMgr-->BCD-->Winload.exe ...

  9. php Basic HTTP与Digest HTTP 应用

    Basic HTTP 认证范例 <?php //Basic HTTP 认证 if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authen ...

  10. 腾讯PCG(后台开发) 牛客网视频面试 一面

    腾讯视频面试 作为一个小渣渣记录一下,腾讯是我一直想进的公司,但其实准备的时间不是很长,也不是科班还是存在很大的劣势,记录一下找工作的经历. 首先说一下,这是我第一次视频面试,还是蛮紧张的.不过面试官 ...