結果

問題 No.2610 Decreasing LCMs
ユーザー LyricalMaestro
提出日時 2025-05-05 16:44:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 82,060 KB
実行使用メモリ 54,872 KB
最終ジャッジ日時 2025-05-05 16:44:52
合計ジャッジ時間 4,844 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/2610

import math

def is_prime(p):
    sqrt_p = int(math.sqrt(p))
    for q in range(2, sqrt_p + 1):
        if p % q == 0:
            return False
        
    return True


def main():
    N = int(input())
    array = [5, 6, 8]
    primes = {2, 3, 5}
    for _ in range(3, N):
        new_array = []
        for a in array:
            new_array.append(a * 2)
        
        for p in range(2, 10000):
            if p not in primes and is_prime(p):
                primes.add(p)
                array = [p] + new_array
                break
    
    print(" ".join(map(str, array)))


if __name__ == '__main__':
    main()
0