| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 54760 | 陶俊宸 | 挑质数 | C++ | Accepted | 100 | 0 MS | 288 KB | 415 | 2022-07-29 17:08:58 |
#include<iostream> bool st[10001]={1,1}; int n,pn[10000],pl,a,num,ans[10000]; int main(){ scanf("%d",&n); for(int i=2;i<=10000;i++){ if(!st[i]) pn[pl++]=i; for(int j=0;i*pn[j]<=10000;j++){ st[i*pn[j]]=1; if(!(i%pn[j])) break; } } for(int i=0;i<n;i++){ scanf("%d",&a); if(!st[a]) ans[num++]=a; } printf("%d\n",num); for(int i=0;i<num;i++) printf("%d\n",ans[i]); return 0; }