3 条题解

  • 0
    @ 2024-10-9 16:40:40
    #include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    
    void makehuiwen(ll &x)
    {
        ll t = x / 10;
        while (t)
        {
            ll s = t % 10;
            x = x * 10 + s;
            t /= 10;
        }
    }
    
    bool issushu(ll x)
    {
        for (int i = 2; i < x / 2; i++)
        {
            if (x % i == 0)
            {
                return false;
            }
        }
        return true;
    }
    
    int main()
    {
        ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        ll x;
        cin >> x;
        makehuiwen(x);
        if (issushu(x))
        {
            cout << "prime";
        }
        else
        {
            cout << "noprime";
        }
        return 0;
    }
    

    信息

    ID
    112
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    131
    已通过
    27
    上传者