Submission #11819140


Source Code Expand

Copy
import fractions
K = int(input())
out = 0
L = [0]*K
gcd = [[0]*K for i in range(K)]
for i in range(1,K+1):
    for j in range(1,K+1):
        A = fractions.gcd(i,j)
        gcd[i-1][j-1] = A
        L[A-1]+=1


for i in range(1,K+1):
    for j in range(1,K+1):
        out+=gcd[i-1][j-1]*L[j-1]

print(out)

Submission Info

Submission Time
Task C - Sum of gcd of Tuples (Easy)
User Kthick
Language Python (3.8.2)
Score 300
Code Size 322 Byte
Status AC
Exec Time 82 ms
Memory 10872 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 18
Set Name Test Cases
Sample sample_01, sample_02
All hand_01, large_01, large_02, large_03, large_04, large_05, random_01, random_02, random_03, random_04, random_05, sample_01, sample_02, small_01, small_02, small_03, small_04, small_05
Case Name Status Exec Time Memory
hand_01 AC 26 ms 10372 KB
large_01 AC 81 ms 10696 KB
large_02 AC 78 ms 10736 KB
large_03 AC 81 ms 10872 KB
large_04 AC 82 ms 10800 KB
large_05 AC 76 ms 10796 KB
random_01 AC 33 ms 10572 KB
random_02 AC 61 ms 10592 KB
random_03 AC 44 ms 10704 KB
random_04 AC 64 ms 10736 KB
random_05 AC 39 ms 10760 KB
sample_01 AC 29 ms 10368 KB
sample_02 AC 81 ms 10820 KB
small_01 AC 28 ms 10536 KB
small_02 AC 27 ms 10548 KB
small_03 AC 27 ms 10372 KB
small_04 AC 28 ms 10480 KB
small_05 AC 26 ms 10488 KB