Accepted
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:30:50
- Judged At
- 2024-11-11 03:43:29
- Judged By
- Score
- 100
- Total Time
- 1239ms
- Peak Memory
- 3.344 MiB