Submission #14762965


Source Code Expand

Copy
N = int(input())

def f(x):
  return x * (x+1) // 2

ans = 0
for x in range(1, N+1):
  if x * x > N:
    break
  # x = y
  ans += x * x
  # x < y の 2 倍
  y_high = N//x
  ans += 2 * x * (f(y_high) - f(x))

print(ans)

Submission Info

Submission Time
Task D - Sum of Divisors
User maspy
Language Python (3.8.2)
Score 400
Code Size 234 Byte
Status
Exec Time 35 ms
Memory 9168 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 400 / 400 hand_01.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, sample_01.txt, sample_02.txt, sample_03.txt, sq_01.txt, sq_02.txt, sq_03.txt, sq_04.txt, sq_05.txt, sq_06.txt
Case Name Status Exec Time Memory
hand_01.txt 19 ms 9060 KB
random_01.txt 32 ms 8992 KB
random_02.txt 29 ms 8876 KB
random_03.txt 22 ms 8884 KB
random_04.txt 27 ms 9164 KB
random_05.txt 31 ms 9032 KB
random_06.txt 27 ms 9032 KB
random_07.txt 33 ms 9164 KB
random_08.txt 27 ms 8888 KB
random_09.txt 23 ms 9040 KB
random_10.txt 25 ms 8884 KB
sample_01.txt 25 ms 8884 KB
sample_02.txt 26 ms 9032 KB
sample_03.txt 21 ms 9168 KB
sq_01.txt 23 ms 8980 KB
sq_02.txt 28 ms 8884 KB
sq_03.txt 30 ms 8976 KB
sq_04.txt 26 ms 9168 KB
sq_05.txt 33 ms 9164 KB
sq_06.txt 35 ms 9104 KB