为什么只有80,求大佬帮忙看看
查看原帖
为什么只有80,求大佬帮忙看看
531510
潇潇暮雨寒z楼主2021/8/15 18:29
#include <bits/stdc++.h>
using namespace std;
bool zhishu(int n){
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0){
			return false;
		}
	}
	return true;
}
int main(){
	int n;
	cin>>n;
	int a[n+5];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(zhishu(a[i])==true){
			cout<<a[i]<<" ";
		}
	}
	cout<<endl;
	return 0;
}
2021/8/15 18:29
加载中...