Submission #14788253


Source Code Expand

#!/usr/bin/env python3


def main():
    n = int(input())
    ans = n * (n + 1) - 1  # 1とk 自信

    i = 2
    while i * i <= n:
        num = n // i
        min_i = i * i
        max_i = i * num
        ans += (num - i + 1) * (min_i + max_i)  # 自分自身
        ans -= min_i
        i += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission Info

Submission Time
Task D - Sum of Divisors
User knk_kei
Language Python (3.8.2)
Score 400
Code Size 374 Byte
Status AC
Exec Time 28 ms
Memory 9172 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 20
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 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 AC 18 ms 8872 KiB
random_01.txt AC 26 ms 8992 KiB
random_02.txt AC 21 ms 8976 KiB
random_03.txt AC 20 ms 8880 KiB
random_04.txt AC 24 ms 8872 KiB
random_05.txt AC 20 ms 9172 KiB
random_06.txt AC 22 ms 9036 KiB
random_07.txt AC 25 ms 9168 KiB
random_08.txt AC 23 ms 9036 KiB
random_09.txt AC 23 ms 9036 KiB
random_10.txt AC 23 ms 9040 KiB
sample_01.txt AC 28 ms 8880 KiB
sample_02.txt AC 17 ms 9052 KiB
sample_03.txt AC 18 ms 8992 KiB
sq_01.txt AC 24 ms 8992 KiB
sq_02.txt AC 19 ms 8992 KiB
sq_03.txt AC 25 ms 8888 KiB
sq_04.txt AC 22 ms 8980 KiB
sq_05.txt AC 23 ms 9172 KiB
sq_06.txt AC 19 ms 8988 KiB