【深基4.例13】质数口袋
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
小 A 有一个质数口袋,里面可以装各个质数。他从 开始,依次判断各个自然数是不是质数,如果是质数就会把这个数字装入口袋。
口袋的负载量就是口袋里的所有数字之和。
但是口袋的承重量有限,装的质数的和不能超过 。给出 ,请问口袋里能装下几个质数?将这些质数从小往大输出,然后输出最多能装下的质数的个数,数字之间用换行隔开。
输入格式
一行一个正整数 。
输出格式
将这些质数从小往大输出,然后输出最多能装下的质数个数,所有数字之间有一空行。
100
2
3
5
7
11
13
17
19
23
9
5
2
3
2
11
2
3
5
3
提示
数据保证,。
假期基础训练(第一周)
- Status
- Done
- Problem
- 14
- Open Since
- 2025-6-27 0:00
- Deadline
- 2025-8-31 23:59
- Extension
- 24 hour(s)