mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
28 lines
432 B
C++
28 lines
432 B
C++
|
#include <iostream>
|
||
|
#include <cmath>
|
||
|
using namespace std;
|
||
|
int prime(int x)
|
||
|
{
|
||
|
if(x==1)
|
||
|
return 0;
|
||
|
for(int i=2; i<=sqrt(x); i++)
|
||
|
if(x%i==0)
|
||
|
return 0;
|
||
|
return 1;
|
||
|
}
|
||
|
int main()
|
||
|
{
|
||
|
int n,x;
|
||
|
while((cin>>n)>0)
|
||
|
{
|
||
|
int sum=0;
|
||
|
while(n--)
|
||
|
{
|
||
|
cin>>x;
|
||
|
sum+=prime(x);
|
||
|
}
|
||
|
cout<<sum<<endl;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|