@李某

Kinghero King of the summit 2023-07-13 10:10:26 1

#79为什吗只有86分

#include <bits/stdc++.h>
using namespace std;
bool ss(int x) {
    if (x == 1 || x == 2) {
        return false;
    }
    for (int i = 2; i < x; i++)
        if (x % i == 0)
            return false;
    return true;
}
int main() {
    freopen("prime.in", "r", stdin);
    freopen("prime.out", "w", stdout);
    int n;
    cin >> n;
    if (ss(n))
        cout << n << " is a prime number.";
    else
        cout << n << " is not a prime number.";
    return 0;
}
{{ vote && vote.total.up }}

共 1 条回复

Kinghero King of the summit

李老师

 快教我AC