結果
問題 |
No.537 ユーザーID
|
ユーザー |
![]() |
提出日時 | 2018-05-11 18:56:14 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 1,134 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2024-06-28 03:57:33 |
合計ジャッジ時間 | 2,257 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
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))