Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- #define NN 10001
- using namespace std;
- int n,v[NN];
- int main()
- {
- v[0]=v[1]=1;
- for(int i=2;i*i<NN;++i)
- if(v[i]==0)
- for(int j=2;i*j<NN;++j)
- v[i*j]=1;
- cin>>n;
- int x,nr=0;
- double s=0;
- for(int i=1;i<=n;++i)
- {
- cin>>x;
- if(v[x]==0)
- s+=x,++nr;
- }
- cout<<fixed<<setprecision(2)<<trunc(s/nr*100)/100;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement