Loading

K-Primes

传送门

题面

Given \(l\) and \(k\), Cuber QQ wants you to answer if there are more than \(k\) primes (i.e., at least \(k+1\) primes) in \([l,l+2k)\).

Input

One line with two space-separated integers \(l,k(1≤l,k≤10^8)\).

Output

One line with "Yes" or "No".

Examples

Input

3 3

Output

No

Input

2 1

Output

Yes

题目分析

任选一个\([l,l+2k)\)的区间,会发现,对于大部分长度为\(2k-1\)的区间,奇数数量满足\(num_{Odd}\le k\)的关系,但是有一组特殊的范围:\([2,3],[2,3,4,5],[2,3,4,5,6,7]\)满足\(num_{Odd}>k\),所以得到答案:只有\(l=2,1\le k\le 3\)时输出Yes,其余情况输出No

AC 代码足

AC 代码

#include <bits/stdc++.h>
#define io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
long long l, k;
int main() { 
    io;
    cin >> l >> k;
    if(l == 2) {
        if(k >= 1 && k <= 3) puts("Yes");
        else puts("No");
    }  else puts("No");
    
    return 0;
}
posted @ 2021-04-19 23:15  Frank_Ou  阅读(153)  评论(2编辑  收藏  举报