結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
76,836 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 83 ms
77,004 KB
testcase_25 AC 82 ms
77,008 KB
testcase_26 AC 80 ms
76,580 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())
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