Time Exceeded
Code
import math as m
t = int(input())
for _ in range(t):
#x = list(map(int, input().split()))
B = int(input())
sqB = B*B
limit = int((sqB/2)+5)
ans = -1
for h in range(limit,1,-1):
sqH = sqB+h*h
H = int(m.sqrt(sqH))
if(H*H==sqH):
ans = H+h+B
break
print(ans)
Information
- Submit By
- Type
- Submission
- Problem
- P1027 Right triangle
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-01-15 10:34:21
- Judged At
- 2024-11-11 03:43:28
- Judged By
- Score
- 90
- Total Time
- ≥2032ms
- Peak Memory
- ≥3.137 MiB