Skip to content

Instantly share code, notes, and snippets.

@modos
Created July 24, 2023 20:49
Show Gist options
  • Save modos/e2f8fc0d0eb2f21e3054384bd56742dd to your computer and use it in GitHub Desktop.
Save modos/e2f8fc0d0eb2f21e3054384bd56742dd to your computer and use it in GitHub Desktop.
نقشه گز
import math
def solve():
x_1, y_1, x_2, y_2 = map(int, input().split())
ans = 0.0
if x_1 == x_2:
ans = abs(y_1 - y_2)
elif y_1 == y_2:
ans = abs(x_1 - x_2)
else:
r_1 = abs(x_1) + abs(y_1);
r_2 = abs(x_2) + abs(y_2);
ans = 0.5 * math.pi * min(r_1, r_2) + abs(r_1 - r_2);
print(f'{ans:.6f}')
t = int(input())
for i in range(t):
solve()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment