「CF80A」Panoramix's Prediction

Portal

Portal1: Codeforces

Portal: Luogu

Code

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>

using namespace std;

int n, m, pri[15] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
int main() {
    scanf("%d%d", &n, &m);
    int x = -2, y = -2;
    for (int i = 0; i < 15; i++) {
        if (n == pri[i]) x = i;
        if (m == pri[i]) y = i;
    }
    if (fabs(x - y) == 1) printf("YES\n"); else printf("NO\n");
    return 0;
}
posted @ 2020-03-27 10:13  XiaoHuang666  阅读(160)  评论(0编辑  收藏  举报