Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- declare(strict_types=1);
- $x1 = intval(readline());
- $y1 = intval(readline());
- $x2 = intval(readline());
- $y2 = intval(readline());
- $x3 = intval(readline());
- $y3 = intval(readline());
- $x4 = intval(readline());
- $y4 = intval(readline());
- $line1 = calculateLineLength($x1, $y1, $x2, $y2);
- $line2 = calculateLineLength($x3, $y3, $x4, $y4);
- function calculateLineLength(int $x1, int $y1, int $x2, int $y2): float {
- $result = sqrt(((pow($x2 - $x1, 2)) + ((pow($y2 - $y1, 2)))));
- return $result;
- }
- if ($line1 >= $line2) {
- if (abs($x1) < abs($x2) && abs($y1) < abs($y2)) {
- printf("(%d, %d)(%d, %d)", $x1, $y1, $x2, $y2);
- } else {
- printf("(%d, %d)(%d, %d)", $x2, $y2, $x1, $y1);
- }
- } else {
- if (abs($x3) < abs($x4) && abs($y3) < abs($y4)) {
- printf("(%d, %d)(%d, %d)", $x3, $y3, $x4, $y4);
- } else {
- printf("(%d, %d)(%d, %d)", $x4, $y4, $x3, $y3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement