P27525 [洛谷] [XJTUPC2024] Core of the Banyan Tree
普及-
题目描述

Problem Description

The game map consists of several regular hexagons. Players can control the core of the banyan tree to move from the center of one hexagon to the center of an adjacent hexagon to reinforce branches, clear pests, grow new branches, or destroy other banyan trees.

The planar grid of regular hexagons can be seen as the isometric projection of a three-dimensional structure made of cubes (as shown in the figure). Each cube's projection is a regular hexagon, and thus the spatial coordinates of the cubes can be used to represent the coordinates of the hexagons. We stipulate that the center of a certain cube is at the origin, and all cube centers have coordinates \((x, y, z)\) that satisfy \(x + y + z = 0\). Therefore, one dimension can be omitted, and \((x, y)\) can be used to describe the center of the corresponding hexagon. This coordinate system is called longitudinal coordinates.

The game uses longitudinal coordinates to depict the positions of hexagons. To allow players to visually see the core's position, Veritas needs to convert these coordinates into planar rectangular coordinates for display on the screen. Please help him convert the longitudinal coordinates into planar rectangular coordinates.

The conversion formula from longitudinal coordinates \((x, y)\) to planar rectangular coordinates \((x', y')\) is:

\[ x' = \frac{1}{2} x + \frac{1}{2} y \]

\[ y' = \frac{\sqrt{3}}{2} x - \frac{\sqrt{3}}{2} y \]

Input Format

A single line with two integers \(x, y\) separated by a space, representing the longitudinal coordinates \((x, y)\) (\(-10^6 \le x \le 10^6, -10^6 \le y \le 10^6\)).

Output Format

A single line with two real numbers \(x'\) and \(y'\) separated by a space, representing the converted planar rectangular coordinates \((x', y')\).

The output is considered correct if the relative or absolute error of each of the two real numbers is no more than \(10^{-6}\).

Sample Input and Output

Input Sample #1

114 514

Output Sample #1

314.000000 -346.410162

Input Sample #2

0 0

Output Sample #2

0.000000 0.000000

Input Sample #3

1000000 -1000000

Output Sample #3

0.000000 1732050.807569

Input Sample #4

3 5

Output Sample #4

4.000000 -1.732051

Input Sample #5

-19 23

Output Sample #5

2.000000 -36.373067

Notes

The game "Core of the Banyan Tree" can be accessed at core-of-banyan.github.io.

Feel free to play the game after the competition.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
114 514
样例输出
314.000000 -346.410162