/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 20ms 3.086 MiB
#2 Accepted 94ms 3.129 MiB
#3 Accepted 348ms 3.133 MiB
#4 Accepted 105ms 2.992 MiB
#5 Accepted 172ms 3.129 MiB
#6 Accepted 23ms 3.031 MiB
#7 Accepted 21ms 3.117 MiB
#8 Accepted 20ms 3.062 MiB
#9 Time Exceeded ≥2032ms ≥3.129 MiB
#10 Accepted 1951ms 3.137 MiB
#11 Accepted 19ms 3.133 MiB

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