結果

問題 No.1616 Joke
ユーザー hir355hir355
提出日時 2021-07-22 21:23:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,151 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 75,348 KB
最終ジャッジ日時 2023-09-24 15:26:33
合計ジャッジ時間 2,372 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,224 KB
testcase_01 AC 75 ms
75,148 KB
testcase_02 AC 77 ms
75,344 KB
testcase_03 AC 74 ms
75,280 KB
testcase_04 AC 73 ms
75,308 KB
testcase_05 AC 73 ms
75,348 KB
testcase_06 AC 73 ms
75,316 KB
testcase_07 AC 74 ms
75,284 KB
testcase_08 AC 74 ms
75,256 KB
testcase_09 AC 74 ms
75,280 KB
testcase_10 AC 73 ms
75,232 KB
testcase_11 AC 74 ms
75,004 KB
testcase_12 AC 76 ms
75,276 KB
testcase_13 AC 77 ms
75,176 KB
testcase_14 AC 77 ms
75,280 KB
testcase_15 AC 76 ms
75,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class osa_k:
    min_factor = []
    def __init__(self, n):
        self.min_factor = list(range(n + 1))
        i = 2
        while i * i <= n:
            if self.min_factor[i] < i:
                i += 1
                continue
            for j in range(i*i, n + 1, i):
                if self.min_factor[j] == j:
                    self.min_factor[j] = i
            i += 1

    def factor(self, n):
        res = []
        while n > 1:
            res.append(self.min_factor[n])
            n //= self.min_factor[n]
        return res

    def divisors(self, n):
        res = [1]
        while n > 1:
            x = self.min_factor[n]
            cnt = 0
            while n % x == 0:
                cnt += 1
                n //= x
            t = []
            p = 1
            for i in range(cnt + 1):
                for j in range(len(res)):
                    t.append(res[j] * p)
                p *= x
            res = t[:]
        return res

os = osa_k(1000)
n = int(input())
d = os.divisors(n)
a = 0
b = 1
for i in range(len(d)):
    a += d[i]
    b *= d[i]
c = 0
for i in range(len(d)):
    c += b // d[i]
print(a * b // c)
0