CF630O.Arrow

普及+/提高

通过率:0%

时间限制:0.50s

内存限制:64MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Petya has recently started working as a programmer in the IT city company that develops computer games.

Besides game mechanics implementation to create a game it is necessary to create tool programs that can be used by game designers to create game levels. Petya's first assignment is to create a tool that allows to paint different arrows on the screen.

A user of this tool will choose a point on the screen, specify a vector (the arrow direction) and vary several parameters to get the required graphical effect. In the first version of the program Petya decided to limit parameters of the arrow by the following: a point with coordinates (px, py), a nonzero vector with coordinates (vx, vy), positive scalars a, b, c, d, a > c.

The produced arrow should have the following properties. The arrow consists of a triangle and a rectangle. The triangle is isosceles with base of length a and altitude of length b perpendicular to the base. The rectangle sides lengths are c and d. Point (px, py) is situated in the middle of the triangle base and in the middle of side of rectangle that has length c. Area of intersection of the triangle and the rectangle is zero. The direction from (px, py) point to the triangle vertex opposite to base containing the point coincides with direction of (vx, vy) vector.

Enumerate the arrow points coordinates in counter-clockwise order starting from the tip.

佩佳最近开始在IT城市一家开发电脑游戏的公司担任程序员。

除了实现游戏机制以开发游戏外,还需要创建一些工具程序,供游戏设计师用来制作游戏关卡。佩佳的第一个任务是开发一个可在屏幕上绘制各类箭头的工具。

该工具的用户将在屏幕上选择一个点,指定一个向量(即箭头方向),并调整若干参数以获得所需的图形效果。在程序的第一版中,佩佳将箭头的参数限定如下:一个坐标为 (px, py)(p_x,\,p_y) 的点;一个非零向量,其坐标为 (vx, vy)(v_x,\,v_y);若干正标量 a, b, c, da,\,b,\,c,\,d,且满足 a>ca > c。

所生成的箭头需具备以下性质:箭头由一个三角形和一个矩形组成。该三角形为等腰三角形,底边长度为 aa,垂直于底边的高为 bb;矩形的边长分别为 cc 和 dd。点 (px, py)(p_x,\,p_y) 位于三角形底边的中点,同时也位于矩形一条长度为 cc 的边的中点。三角形与矩形的交集面积为零。从点 (px, py)(p_x,\,p_y) 指向三角形底边(该底边包含该点)所对顶点的方向,与向量 (vx, vy)(v_x,\,v_y) 的方向一致。

请按逆时针顺序列出箭头各顶点的坐标,起始点为箭头尖端(即三角形顶点)。

输入格式

The only line of the input contains eight integers px, py, vx, vy ( - 1000 ≤ px, py, vx, vy ≤ 1000, _vx_2 + _vy_2 > 0), a, b, c, d (1 ≤ a, b, c, d ≤ 1000, a > c).

输入仅包含一行,其中有八个整数 pxpx、pypy、vxvx、vyvy(−1000≤px,py,vx,vy≤1000-1000 \le px, py, vx, vy \le 1000,且 vx2+vy2>0vx^2 + vy^2 > 0),以及 aa、bb、cc、dd(1≤a,b,c,d≤10001 \le a, b, c, d \le 1000,且 a>ca > c)。

输出格式

Output coordinates of the arrow points in counter-clockwise order. Each line should contain two coordinates, first x, then y. Relative or absolute error should not be greater than 10 - 9.

以逆时针顺序输出箭头端点的坐标。每行应包含两个坐标,先为 x,再为 y。相对误差或绝对误差均不得超过 10−910^{-9}。

输入输出样例

  • 输入#1

    8 8 0 2 8 3 4 5

    输出#1

    8.000000000000 11.000000000000
    4.000000000000 8.000000000000
    6.000000000000 8.000000000000
    6.000000000000 3.000000000000
    10.000000000000 3.000000000000
    10.000000000000 8.000000000000
    12.000000000000 8.000000000000

输入解题思路,AI测评打分。不知道怎么写?

首页