/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 3.086 MiB
#2 Accepted 15ms 3.023 MiB
#3 Accepted 23ms 2.887 MiB
#4 Accepted 15ms 3.023 MiB
#5 Accepted 105ms 3.156 MiB
#6 Accepted 80ms 3.102 MiB
#7 Accepted 76ms 3.16 MiB
#8 Accepted 157ms 3.281 MiB

Code

t = int(input())
for _ in range(t):
    n = int(input())
    k = 1
    while(k*2<n):
        k = k*2
    ans = (n*(n-1))//2
    while(k):
        ans += k//2
        k = k//2
    print(ans)

Information

Submit By
Type
Submission
Problem
P1026 LUFA cup 2024
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-14 09:22:34
Judged At
2024-11-11 03:43:31
Judged By
Score
100
Total Time
157ms
Peak Memory
3.281 MiB