UKE!!大佬们能否帮忙看一下
查看原帖
UKE!!大佬们能否帮忙看一下
843733
cubehead楼主2023/4/11 22:26
#include <iostream>

using namespace std;

int t;

bool is_prime(int x) {
    if (x == 1) return false;
    for (int i = 2; i <= x / i; i++)
        if (x % i == 0)
            return false;
    return true;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> t;
    for (int i = 1; i <= t; i++) {
        int m, n;
        cin >> m >> n;
        for (int j = m; j <= n; j++) 
            if (is_prime(j))
                cout << j << endl;
        cout << endl;
    }
    return 0;
}

这是怎么回事,样例过了,是我要注册spoj号吗

2023/4/11 22:26
加载中...