ACM 训练日志记录 · 思考 · 成长 提交 / 修改记录
郭一鸣 / 题目列表训练档案
导出

2253A Educational Codeforces Round 193 (Rated for Div. 2)

来源:Codeforces ★ 800

本题活力0.18按难度、完成结果与训练证据估算

算法如山行则将至

题目描述

判断是否存在一张牌能击败所有其他牌。

代码

#include<iostream>
using namespace std;
bool is_prime(int x)
{
    if(x<2)return false;
    for(int i=2;i*i<=x;i++)
    {
        if(x%i==0)return false;
    }
    return true;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;cin>>n;
        if(is_prime(n+1))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}