Submission #11814425


Source Code Expand

Copy
import sys
import math
from functools import reduce
def input(): return sys.stdin.readline().rstrip()
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def main():
    k=int(input())
    sum=0
    for i in range(1,k-1):
        for j in range(i+1,k):
            for l in range(j+1,k+1):
                sum+=gcd(i,j,l)*6
    for i in range(1,k+1):
        for j in range(1,k+1):
            if i!=j:
                sum+=gcd(i,j,j)*3
    for i in range(1,k+1):
        sum+=gcd(i,i,i)
    print(sum)

if __name__=='__main__':
    main()

Submission Info

Submission Time
Task C - Sum of gcd of Tuples (Easy)
User charter
Language Python (3.8.2)
Score 300
Code Size 565 Byte
Status
Exec Time 550 ms
Memory 9660 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01, sample_02
All 300 / 300 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 22 ms 9500 KB
large_01 532 ms 9344 KB
large_02 521 ms 9344 KB
large_03 514 ms 9348 KB
large_04 510 ms 9576 KB
large_05 500 ms 9576 KB
random_01 32 ms 9504 KB
random_02 273 ms 9340 KB
random_03 134 ms 9508 KB
random_04 295 ms 9496 KB
random_05 82 ms 9504 KB
sample_01 21 ms 9640 KB
sample_02 550 ms 9660 KB
small_01 24 ms 9352 KB
small_02 19 ms 9336 KB
small_03 21 ms 9440 KB
small_04 21 ms 9640 KB
small_05 25 ms 9636 KB