結果

問題 No.2081 Make a Test Case of GCD Subset
ユーザー lilictakalilictaka
提出日時 2022-09-26 23:28:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 77,656 KB
最終ジャッジ日時 2023-08-24 03:15:54
合計ジャッジ時間 7,718 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
77,168 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 AC 84 ms
77,088 KB
testcase_25 AC 82 ms
77,136 KB
testcase_26 AC 81 ms
77,040 KB
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def erastotenes(n):
    is_prime = [True] *(n+1)
    is_prime[1] = False
    for p in range(2,n+1):
        if is_prime[p] == False:
            continue
        is_prime[p] = True
        k = 2
        while k * p < (n+1):
            is_prime[k*p] = False
            k +=1
    return is_prime
M = int(input())
if M == 0:
    M = 998244353
P = erastotenes(10 ** 5 + 1)
ans = []
for p in range(2,10**5+1):
    if P[p]:
        cnt =1
        while pow(p,cnt) <=10 ** 5 and pow(2,cnt) -1 <=M:
            ans.append(pow(p,cnt))
            cnt +=1
        M-=pow(2,cnt-1) -1

print(len(ans)) 
print(*ans)
0