結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー terasaterasa
提出日時 2022-06-15 22:10:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,649 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 78,540 KB
最終ジャッジ日時 2024-04-15 07:24:59
合計ジャッジ時間 6,900 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 216 ms
78,008 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 54 ms
63,812 KB
testcase_29 AC 53 ms
62,464 KB
testcase_30 AC 55 ms
64,164 KB
testcase_31 AC 54 ms
63,224 KB
testcase_32 AC 54 ms
63,592 KB
testcase_33 AC 53 ms
63,364 KB
testcase_34 AC 53 ms
63,852 KB
testcase_35 WA -
testcase_36 AC 54 ms
65,032 KB
testcase_37 AC 54 ms
63,280 KB
testcase_38 AC 54 ms
64,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


class PrimeTable:
    def __init__(self, N):
        self.is_prime = [True] * (N + 1)

        self.is_prime[0] = False
        self.is_prime[1] = False
        for i in range(2, N + 1):
            if i * i > N:
                break
            if self.is_prime[i] is False:
                continue
            for j in range(2, N + 1):
                if i * j > N:
                    break
                self.is_prime[i * j] = False

        self.primes = [n for n in range(2, N + 1) if self.is_prime[n]]

    def is_prime(self, n):
        return self.is_prime[n]


primes = PrimeTable(10 ** 5).primes
T = int(input())
for _ in range(T):
    X = int(input())
    a = 1 << 40
    for p in primes:
        if a <= p:
            break
        x = X
        cnt = 0
        while x % p == 0:
            x //= p
            cnt += 1
        a = min(a, pow(p, cnt + 1))
    print(X * a)
0