Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n, v[201],ok,c,i,d;
  9. cin>>n;
  10. for(i=1;i <=n;i++)
  11. cin>>v[i];
  12. c=0;
  13. for (i=1;i <=n;i++){
  14. ok=1;
  15. if (v[i]==0||v[i]==1)
  16. ok=1;
  17. int x = sqrt(v[i]);
  18. if(v[i]%2 == 1){
  19. for (d=3;d<=x;d+=2){
  20. if (v[i]%d == 0){
  21. ok=0;
  22. }
  23. }
  24. }
  25. else{
  26. ok=0;
  27. }
  28. if (ok == 1)
  29. c++;
  30. }
  31. if (c==0)
  32. cout <<"NU";
  33. else
  34. cout <<"DA";
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement