求助!!!
查看原帖
求助!!!
1233340
lmxkevin楼主2024/10/10 21:03

自测全过,测评全错

#include<bits/stdc++.h>
using namespace std;
const int zhisubiao[25] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
void solve() {
    int n;
    cin >> n;
    if(n == 0) {
        cout << 0 << endl;
        return;
    }
    int cnt = 0;
    for(int i = 0; i < 25; i++) {
        bool flag = 0;
        int num = zhisubiao[i];
        while(n % num == 0) {
            if(!flag) flag = 1, cnt++;
            n /= num;
        }
    }
    if(cnt == 2) {
        cout << 1 << endl;
    }
    else cout << 0 << endl;
}
int main() {
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}
2024/10/10 21:03
加载中...