P5723 【深基4.例13】质数口袋-2022.02.01(python3实现)

【深基4.例13】质数口袋 - 洛谷

"""

P5723 【深基4.例13】质数口袋-2022.02.01(python3实现)
https://www.luogu.com.cn/problem/P5723

"""

lena=0

cnt=0

prime=[1 for i in range(100010)]

lena=int(input())

prime[1]=0
prime[0]=0

for i in range(2,100010):

            if prime[i]==1:

                        j=i*2
                        while j<100010:
                                    prime[j]=0
                                    j+=i

for i in range (2,100010):

            if prime[i]==1:
                        if lena>=i:

                                    print(i)

                                    lena-=i

                                    cnt+=1
                        else:
                                    break

print(cnt)


上一篇:TCL Linkhub 5G CPE Released


下一篇:1007 素数对猜想