40分,求debug
查看原帖
40分,求debug
1189340
aishiteru_mitsu_ha楼主2023/12/25 18:38
#include<bits/stdc++.h>
using namespace std;
bool cnt;
int main(){
    long long a;
    vector<int> n;
    cin>>a;
    for(int i=0;i<a;i++){
        int b;
        cin>>b;
        for(int j=2;j<sqrt(b);j++){
            if(b%j==0){
                cnt=true;
                break;
            }
        }
        if(cnt==false){
            n.push_back(b);
        }else{
            cnt=false;
        }
    }
    for(int i=0;i<n.size();i++){
        cout<<n[i]<<" ";
    }
    return 0;
}
2023/12/25 18:38
加载中...