A7865 | Noldbach problem
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Nick is interested in prime numbers. Once he read about Goldbach problem. It states that every even integer greater than $2$ can be expressed as the sum of two primes. That got Nick's attention and he decided to invent a problem of his own and call it Noldbach problem. Since Nick is interested only in prime numbers, Noldbach problem states that at least $k$ prime numbers from $2$ to $n$ inclusively can be expressed as the sum of three integer numbers: two neighboring prime numbers and $1$ . For example, 19 = 7 + 11 + 1, or 13 = 5 + 7 + 1.
Two prime numbers are called neighboring if there are no other prime numbers between them.
You are to help Nick, and find out if he is right or wrong.
Two prime numbers are called neighboring if there are no other prime numbers between them.
You are to help Nick, and find out if he is right or wrong.
输入格式
The first line of the input contains two integers $n$ ( $2<=n<=1000$ ) and $k$ ( $0<=k<=1000$ ).
输出格式
Output YES if at least $k$ prime numbers from $2$ to $n$ inclusively can be expressed as it was described above. Otherwise output NO.
输入输出样例
输入 #1
27 2
输出 #1
YES
输入 #2
45 7
输出 #2
NO
In the first sample the answer is YES since at least two numbers can be expressed as it was described (for example, 13 and 19). In the second sample the answer is NO since it is impossible to express 7 prime numbers from 2 to 45 in the desired form.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted