結果

問題 No.537 ユーザーID
ユーザー FVRChanFVRChan
提出日時 2018-05-11 18:56:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 1,134 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 11,144 KB
実行使用メモリ 10,184 KB
最終ジャッジ日時 2023-09-10 12:37:57
合計ジャッジ時間 2,097 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,332 KB
testcase_01 AC 16 ms
8,304 KB
testcase_02 AC 16 ms
8,120 KB
testcase_03 AC 16 ms
8,448 KB
testcase_04 AC 17 ms
8,332 KB
testcase_05 AC 16 ms
8,448 KB
testcase_06 AC 16 ms
8,424 KB
testcase_07 AC 16 ms
8,492 KB
testcase_08 AC 16 ms
8,252 KB
testcase_09 AC 16 ms
8,272 KB
testcase_10 AC 16 ms
8,272 KB
testcase_11 AC 16 ms
8,420 KB
testcase_12 AC 16 ms
8,244 KB
testcase_13 AC 16 ms
8,496 KB
testcase_14 AC 16 ms
8,380 KB
testcase_15 AC 16 ms
8,492 KB
testcase_16 AC 16 ms
8,408 KB
testcase_17 AC 17 ms
8,304 KB
testcase_18 AC 16 ms
8,336 KB
testcase_19 AC 20 ms
8,336 KB
testcase_20 AC 125 ms
8,248 KB
testcase_21 AC 16 ms
8,424 KB
testcase_22 AC 16 ms
8,424 KB
testcase_23 AC 17 ms
8,080 KB
testcase_24 AC 16 ms
8,448 KB
testcase_25 AC 16 ms
8,404 KB
testcase_26 AC 16 ms
8,448 KB
testcase_27 AC 16 ms
8,420 KB
testcase_28 AC 21 ms
9,312 KB
testcase_29 AC 26 ms
10,184 KB
testcase_30 AC 25 ms
9,900 KB
testcase_31 AC 16 ms
8,368 KB
testcase_32 AC 16 ms
8,436 KB
testcase_33 AC 20 ms
9,220 KB
testcase_34 AC 16 ms
8,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n /= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff
def divisor_sub(p, q):
    a = []
    for i in range(0, q + 1):
        a.append(p ** i)
    return a

def divisor(n):
    xs = factorization(n)
    ys = divisor_sub(xs[0][0], xs[0][1])
    for p, q in xs[1:]:
        ys = [x * y for x in divisor_sub(p, q) for y in ys]
    return sorted(ys)

n=int(input())
if n==1:
	print(1)
	exit()
stack,pair=list(map(int,divisor(n))),[]
for i in range(int(len(stack)/2)+len(stack)%2):
	pair.append([stack[i],stack[len(stack)-1-i]])

strings=[]
for p in pair:
	strings.append(str(p[0])+str(p[1]))
	strings.append(str(p[1])+str(p[0]))
strings=list(set(strings))
print(len(strings))
0