【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

这个x2,y2和圆心(x1,y1)相连。形成的直线和圆交于点(x3,y3)
则(x2,y2)和(x3,y3)的中点就是所求圆的圆心。
半径就是x2,y2到x3,y3的距离的一半。
写个向量的方法,求出x3,y3的坐标就好了。

【代码】

#include <bits/stdc++.h>
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define ls l,mid,rt<<1
#define rs mid+1,r,rt<<1
#define double long double
using namespace std; const double pi = acos(-1);
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0}; LL R,x1,y1,x2,y2; LL sqr(LL x){
return x*x;
} void solve(){
cin >> R >> x1 >> y1 >> x2 >> y2;
if (sqr(x1-x2)+sqr(y2-y1)>=sqr(R)){
cout<<x1<<' '<<y1<<' '<<R<<endl;
return;
} if (x1==x2 && y1==y2){
cout<<fixed<<setprecision(10)<<x1+R/2.0<<' '<<y1<<' ';cout<<fixed<<setprecision(10)<<(double)R/2.0<<endl;
return;
} double t1 = sqrt(sqr(x1-x2)+sqr(y2-y1)),t2 = R;
double x3 = x1-t2/t1*(x2-x1);
double y3 = y1-t2/t1*(y2-y1);
cout<<fixed<<setprecision(10)<<(x2+x3)/2.0<<' '<<(y2+y3)/2.0<<' '<<(t1+t2)/2.0<<endl;
} int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
int T;
T = 1;
while(T--){
solve();
}
return 0;
}

【Codeforces Round #465 (Div. 2) C】Fifa and Fafa的更多相关文章

  1. 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers

    [链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...

  2. 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes

    [题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...

  3. 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees

    [题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...

  4. 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory

    [题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...

  5. 【Codeforces Round #423 (Div. 2) C】String Reconstruction

    [Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i ...

  6. 【Codeforces Round #423 (Div. 2) B】Black Square

    [Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...

  7. 【Codeforces Round #423 (Div. 2) A】Restaurant Tables

    [Link]:http://codeforces.com/contest/828/problem/A [Description] 有n个组按照时间顺序来餐馆; 每个组由一个人或两个人组成; 每当有一个 ...

  8. 【Codeforces Round #422 (Div. 2) D】My pretty girl Noora

    [题目链接]:http://codeforces.com/contest/822/problem/D [题意] 有n个人参加选美比赛; 要求把这n个人分成若干个相同大小的组; 每个组内的人数是相同的; ...

  9. 【Codeforces Round #422 (Div. 2) C】Hacker, pack your bags!(二分写法)

    [题目链接]:http://codeforces.com/contest/822/problem/C [题意] 有n个旅行计划, 每个旅行计划以开始日期li,结束日期ri,以及花费金钱costi描述; ...

随机推荐

  1. SpringBoot学习笔记(8)-----SpringBoot文件上传

    直接上代码,上传文件的前端页面: <body> <form action="/index/upload" enctype="multipart/form ...

  2. How Javascript works (Javascript工作原理) (五) 深入理解 WebSockets 和带有 SSE 机制的HTTP/2 以及正确的使用姿势

    个人总结: 1.长连接机制——分清Websocket,http2,SSE: 1)HTTP/2 引进了 Server Push 技术用来让服务器主动向客户端缓存发送数据.然而,它并不允许直接向客户端程序 ...

  3. POJ-1113 Wall 计算几何 求凸包

    题目链接:https://cn.vjudge.net/problem/POJ-1113 题意 给一些点,求一个能够包围所有点且每个点到边界的距离不下于L的周长最小图形的周长 思路 求得凸包的周长,再加 ...

  4. mysql 修改默认的引擎

      需求: mysql 的默认的引擎为MyISAM  虽然该引擎访问的速度快,但并不支持存储事物,也不支持外键,所以我们修改为innob Linux修改MySql默认存储引擎为InnoDB     一 ...

  5. H3C S5130交换机堆叠操作

    配置过程中注意事项: 1.最好提前定义好IRF的主从设备,可通过IRF优先级进行定义,越大越优 2.一定要在使能IRF之前就保存配置(因为使能过程中,会出现设备重启的情况,如果设备重启后配置丢失,会导 ...

  6. pandas 7 合并 merge 水平合并,数据会变宽

    pd.merge( df1, df2, on=['key1', 'key2'], left_index=True, right_index=True, how=['left', 'right', 'o ...

  7. Qt之自定义布局管理器(QBorderLayout)

    简述 QBorderLayout,顾名思义-边框布局,实现了排列子控件包围中央区域的布局. 具体实现要求不再赘述,请参考前几节内容. 简述 实现 效果 源码 使用 实现 QBorderLayout主要 ...

  8. [MST] Store Store in Local Storage

    For an optimal user and developer experience, storing state in local storage is often a must. In thi ...

  9. hdu5105Math Problem(分类讨论)

    题目链接: huangjing 题目: 思路: 给出的是一个方程,首先讨论最高项系数. 1:a==0&& b==0  那么函数就是线性的.直接比較端点就可以. 2   a==0& ...

  10. HDOJ1084 What Is Your Grade?

    What Is Your Grade? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Othe ...