H. Hit!
time limit per test

1.0 s

memory limit per test

256 MB

input

standard input

output

standard output

"Hit!" is a popular game in ancient Byteland.

The very first version of the game is quite simple: each player picks up a stone and throws it at a circle drawn on the ground. A player wins if his/her stone lands inside the circle.

After 20 years of practice, Bitman, a young man living in ancient Byteland, has mastered the skill of throwing stones – he can throw a stone at any specific place he wants. With such skill, Bitman plays "Hit!" without losing a single game. He simply targets every stone at the center of the circle!

The King of Hackerland hears the story of Bitman and wants to challenge him with a harder, though still very simple, version of "Hit!".

In each game, two circles which share a positive common area are drawn on the ground. In order to win, the player must throw a stone at the common area of the two circles.

As Bitman had no idea how to target his stone at the common area, he asks for your help. Given the coordinates of the centers and radii of the two circles, please tell Bitman the coordinates of any point he can target at such that he can win the game.

For simplicity, you can consider the landing position of the stone as a single point.

Input

The input consists of two lines, each describes one circle drawn on the ground. Each line contains three integers xy and r, denoting respectively the x-coordinate, y-coordinate, and the radius of a circle.

All coordinates have their absolute value no more than 100, and 1 ≤ r ≤ 100 for both circles.

Output

Output two numbers, the x-coordinate and y-coordinate of a point where Bitman can throw his stone at to win the game.

Your answer will be accepted if for each of the two circles, the point lies inside the circle or that the distance between the point and the circle is not greater than 10 - 5.

Examples
input
0 0 3
3 4 3
output
1.5 2.5
input
-7 -9 3
-4 -4 5
output
-6 -7
Note

In the first sample, (1.5, 2.5) is a possible answer as it lies inside the common area of two circles drawn. Please note that there exists more than one possible answer in this case. For example, (2, 2), (1, 2) and (2.1, 1.87) are also possible answers.

思路:

水题,特判下两个圆的直径大于两圆心距离的情况,这时只要输出圆心就好了。还以为会卡精度,敲了半天,结果告诉队友特判,队友一顿乱敲没考虑精度直接过了。。mmp.

实现代码:

#include<bits/stdc++.h>
using namespace std; int main()
{
double x1,x2,y1,y2,z1,z2;
cin>>x1>>y1>>z1;
cin>>x2>>y2>>z2;
double len = pow((x2 - x1),) + pow((y2 - y1),);
len = sqrt(len);
//cout<<"len :"<<len<<endl;
double len1 = len - z1;
double len2 = len - z2;
//cout<<len1<<" "<<len2<<endl;
if(len1<=){
cout<<x2<<" "<<y2<<endl;
return ;
}
else if(len2<=){
cout<<x1<<" "<<y1<<endl;
return ;
}
double f1 = x2-x1;
double f2 = y2-y1;
double k = len2/len;
//cout<<k<<endl;
f1 *= k;
f2 *= k;
//printf("%.6lf\n",len2);
double ans;
while(){
ans = pow(f1,)+pow(f2,);
ans = sqrt(ans);
//printf("%.6lf\n",ans);
if(abs(ans - len2)<0.00001)
break;
else{
if(ans-len2<0.00001){
f1+=0.000001;f2+=0.000001;}
else if(ans-len2>0.00001){
f1-=0.000001;f2-=0.000001;}
}
}
printf("%.6lf %.6lf",x1+f1,y1+f2);
//cout<<pow((x1+f1),2)+pow((y1+f2),2)<<endl;
}

最新文章

  1. 使用python抓取婚恋网用户数据并用决策树生成自己择偶观
  2. html与css面试结合工作的总结难点
  3. Android Studio简单设置
  4. Android学习参考2
  5. CentOS中配置LNMP环境打开提示File not found
  6. 利用dropbox备份vps数据
  7. 转载:mac系统XAMPP配置虚拟主机
  8. poj3275
  9. 抓取csdn上的各类别的文章 (制作csdn app 二)
  10. zabbix监控windows agent安装配置
  11. debugging kubernetes (Delve and Goland)
  12. base64使用
  13. Javaweb拦截器
  14. okhttp3与旧版本okhttp的区别分析
  15. 利用JS自动打开页面上链接的实现代码
  16. java中的深复制和浅复制
  17. Ubuntu安装 Alisql编译安装步骤:
  18. Oracle-&gt;mysql碰到的问题
  19. zookeeper系列之:zookeeper简介浅谈
  20. UE如何去除重复行,删除重复行

热门文章

  1. LoRa---官方例程移植
  2. SSISDB5:使用TSQL脚本执行Package
  3. 命令行启用IIS Express
  4. 巧用cheerio重构grunt-inline
  5. jenkins +gitlab +docker 自动化部署tomcat 项目
  6. jinkens 构建java及vue 项目
  7. 高精度减法--C++
  8. CDH 5.16.1 离线部署 &amp; 通过 CDH 部署 Hadoop 服务
  9. kubeadm安装K8S单master双节点集群
  10. PAT甲题题解-1077. Kuchiguse (20)-找相同后缀