Python 3.5 Przekroczono limit czasu
import math
def dupa(cm,os,obw):
if os % 2 == 0:
res = list(str(round((obw/os),3)))
for j in range(len(res)):
if res[-j] == ".":
res2 = res[0:-j]
res3 = res[-j:-1]
res3.append(res[-1])
while True:
if len(res3) != 4:
res3.append("0")
else:
break
if len(res3) == 4:
break
res4 = res2 + res3
print("".join(res4), int(os/2))
else:
res = list(str(round((obw / (os * 2)), 3)))
for j in range(len(res)):
if res[-j] == ".":
res2 = res[0:-j]
res3 = res[-j:-1]
res3.append(res[-1])
while True:
if len(res3) != 4:
res3.append("0")
else:
break
if len(res3) == 4:
break
res4 = res2 + res3
print("".join(res4), int(os))
for i in range(int(input())):
cm, os = input().split()
cm = int(cm)
os = int(os)
obw = math.pi * cm
dupa(cm,os,obw)