湖大训练赛第十场 Deepest Station

Deepest Station
Time Limit: 2000ms, Special Time Limit:5000ms, Memory Limit:262144KB
Total submit users: 11, Accepted users: 9
Problem 12908 : Special judge
Problem description

The Saint Petersburg Metro is the underground railway sys- tem in Saint Petersburg and Leningrad Oblast, Russia. It has been open since November 15, 1955. Formerly known as the V.I. Lenin Order of Lenin Leningrad Metropoliten, the system exhibits many typical Soviet designs and fea- tures exquisite decorations and artwork making it one of the most attractive and elegant metros in the world. Due to the city’s unique geology, the Saint Petersburg Metro is one of the deepest subway systems in the world and the deep- est by the average depth of all the stations. The system’s deepest station, Admiralteyskaya, is 105 metres below the ground. Serving two and a half million passengers daily, it is also the 12th busiest subway system in the world. From Wikipedia, the free encyclopedia

After building Admiralteyskaya metro station, the government of Saint Petersburg decided to build the really deep station which would be the deepest in the world. It will be d meters under the ground! The station will be built right under the Smolny Sobor and for use by officials only. The Department of Urban Development has its internal coordinate system for building a project. The origin of this system point is exactly the Smolny Sobor and applicate means depth under the ground. So, the new station will have coordinates (0,0,d).

Due to security reasons station’s lobby must be located outside the Smolny Convent, at point (x,y). Your task is to help the government with building moving staircases. The station will use innovative staircases that should go down at angle 45◦. It is possible to build one intermediate lobby somewhere underground (like at Admiralteyskaya) and two staircases. Given x, y and d, find coordinates of intermediate lobby. Note that you cannot dig below d meters under the ground, so the intermediate lobby must not be deeper than the main station.


Input

The only line of the input file contains three integer numbers: x, y and d — the coordinates of the station in the Department of Urban Development coordinate system (−10000 ≤ x,y ≤ 10000; (x,y) ≠ (0,0); 106 ≤ d ≤ 10000).


Output

Output three numbers with precision at least 10 digits after decimal point: coordinates of the intermediate lobby in the Department of Urban Development coordinate system. If it is impossible to build staircases, output “Impossible”. If no intermediate lobby is required, output “Single staircase”.


Sample Input
0 100 300

300 400 500

400 400 500
Sample Output
0.0 200.0 100.0

Single staircase

Impossible

题意:地铁站有一点A(0,0,d),和我们所在位置B(x,y)。三维图。问从(x,y)能否建造电梯到达(0,0,d)点。电梯只能为水平45度方向。并且最多只能建造两个。如果建造一个直接到达则输出Single staircase。若两个都不能到达则输出Impossible。否则则输出两个电梯的交点。

题解:从地铁站看,我们可以用一个45度的线映射到x,y平面形成一个锥形。如果B点在这个锥形形成的圆的边界上,则没问题,可以直接到达。若B点在这个圆外,则无论怎么连个45度都不能与这条锥形的线相交了,所以Impossible。若B在园内,则可以画一条与锥形画下来45度的线垂直的线与他相交,形成交点,这条线会与水平线呈45度。然后我们求这个交点的位置。

从圆点(0,0)连接到B点(x,y),在这条延长线,有一点连到A点呈45度,这条线我们叫做C吧。作B点垂直C于D点的线(此线段必会是45度与水平线)。则D点为所求,我们根据两个勾股定理求得D点的高。再根据等比三角形求出D点的x,y坐标即可。

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <list>
#include <vector>
#define LL __int64
#define EPS 1e-8
using namespace std;
double gg(double a,double b)
{
	return sqrt(a*a+b*b);
}
int main()
{
	double x,y,d;
	while (~scanf("%lf %lf %lf",&x,&y,&d))
	{
		double k=gg(x,y);
		if (k-d>0) puts("Impossible");
		else if (fabs(k-d)<=EPS) puts("Single staircase");
		else
		{
			double s=d-k;
			double h=sqrt(s*s*1.0/2);
			h=sqrt(h*h*1.0/2);
			//if (k+h==d-h) cout<<"YES"<<endl;
			double z=d-h;
			double bb=z*1.0/k;
			x=x*bb;
			y=y*bb;
			printf("%.10lf %.10lf %.10lf\n",x,y,h);
		}
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值