/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 15ms 2.891 MiB
#2 Wrong Answer 16ms 2.926 MiB

Code

def find_triangle_perimeter(base):
    if base % 2 == 0:
        # If base is even, the other sides can be base/2 and hypotenuse = base/2 + 1
        height = base // 2
        hypotenuse = height + 1
        return base + height + hypotenuse
    else:
        # If base is odd, the other sides can be (base-1)/2, (base+1)/2, and hypotenuse = (base+1)/2
        height = (base - 1) // 2
        hypotenuse = (base + 1) // 2
        return base + height + hypotenuse

def main():
    T = int(input())
    for _ in range(T):
        B = int(input())
        perimeter = find_triangle_perimeter(B)
        print(perimeter)

if __name__ == "__main__":
    main()

Information

Submit By
Type
Submission
Problem
P1027 Right triangle
Contest
Brain booster #2
Language
Python 3 (Python 3.12.3)
Submit At
2024-03-06 16:53:30
Judged At
2024-11-11 03:41:10
Judged By
Score
0
Total Time
16ms
Peak Memory
2.926 MiB