【Codeforces Round #465 (Div. 2) C】Fifa and Fafa
【链接】 我是链接,点我呀:)
【题意】
在这里输入题意
【题解】
这个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的更多相关文章
- 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers
[链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...
- 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes
[题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...
- 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees
[题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...
- 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory
[题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...
- 【Codeforces Round #423 (Div. 2) C】String Reconstruction
[Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i ...
- 【Codeforces Round #423 (Div. 2) B】Black Square
[Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...
- 【Codeforces Round #423 (Div. 2) A】Restaurant Tables
[Link]:http://codeforces.com/contest/828/problem/A [Description] 有n个组按照时间顺序来餐馆; 每个组由一个人或两个人组成; 每当有一个 ...
- 【Codeforces Round #422 (Div. 2) D】My pretty girl Noora
[题目链接]:http://codeforces.com/contest/822/problem/D [题意] 有n个人参加选美比赛; 要求把这n个人分成若干个相同大小的组; 每个组内的人数是相同的; ...
- 【Codeforces Round #422 (Div. 2) C】Hacker, pack your bags!(二分写法)
[题目链接]:http://codeforces.com/contest/822/problem/C [题意] 有n个旅行计划, 每个旅行计划以开始日期li,结束日期ri,以及花费金钱costi描述; ...
随机推荐
- JavaScript学习——使用JS完成页面定时弹出广告
1.获取图片的位置(document.getElementById(“”)) 隐藏图片:display:none 定时操作:setInterval(“显示图片的函数”,3000); 2.步骤分析 ( ...
- 记一次使用 removeEventListener 移除事件监听失败的经历
测试一 测试代码如下 var Test = function() { this.element = document.body; this.handler = function() { console ...
- [转] CentOS 7 为firewalld添加开放端口及相关资料
转自http://www.cnblogs.com/hubing/p/6058932.html 1.运行.停止.禁用firewalld 启动:# systemctl start firewalld 查 ...
- lua中调用C++函数
lua中调用C++函数 我们产品中提供了很多lua-C API给用户在lua中调用,之前一直没用深究其实现原理,只是根据已有的代码在编码.显然这不是一个好的习惯,没用达到知其所以然的目的. 一.基本原 ...
- shell编程, 100文钱买100只鸡, 简单实现
今天碰到一个有趣的问题: 群友用shell写的一个: #!/bin/bash # 百元买百鸡,每种鸡至少买一只 all= # 公鸡每只多少元 read -p '公鸡多少文一只: ' gongji # ...
- vuecli的使用之项目中的文件
cli创建的项目截图 node_moudule :下载的依赖包的存储位置. public :html的地方??? src :写代码的地方 man.js :入口文件 .browserslistrc :浏 ...
- Linxu基本指令
一.Linux权限的概念 Linux下有两种用户:普通用户和超级用户(). 普通用户:在linux下做有限的事情: 超级用户:可以在linux系统下做任何事情,不受限制. 普通用户的提示符是“$”,超 ...
- NOIp2018模拟赛四十二
今天看标题终于回到了“NOIP模拟赛”,十分高兴啊! 然后一打开题目: ********** 所以今天又是一场NOIPlus模拟赛(微笑) 成绩:0+70+0=70 A题想了个贪心被myh两分钟cha ...
- 对同层数据进行处理,做成树状图形式的数据结构,并符合elementui中的tree结构
//通过子级的pid找到父级对应的id,制作树状图 var data = [ { id: 1, name: "办公管理", pid: 0 }, { id: 2, name: &qu ...
- bootstrap 因跳页黑色背景无法关闭
只需要在跳页之前加上如下代码: $(".modal-backdrop").remove();