Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,x, pmax=-1, pmin=99999, c, nr=0;
- cin >> n;
- for(int i=1; i<=n; ++i)
- {
- cin >> x;
- c=0;
- for(int j=2; j<=x; ++j)
- if(x%j==0)
- c++;
- if(c==2)
- {
- nr++;
- if(x>pmax)
- pmax=x;
- if(x<pmin)
- pmin=i;
- }
- }
- cout << nr << " " << pmin << " " << pmax;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement