SHARE
TWEET

Untitled

a guest Nov 20th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int v[101][101],n,m,j,i,Nr,x,d;
  5. int main()
  6. {
  7.     cin>>n>>m;
  8.     for(i=1;i<=n;i++)
  9.         for(j=1;j<=m;j++)
  10.            cin>>v[i][j];
  11.     for(i=1;i<=n;i++)
  12.         {
  13.             if(i%2==0)
  14.                 for(j=1;j<=m;j++)
  15.                 {
  16.                 x=v[i][j];
  17.                 d=2;
  18.                 while(d*d<=x && x%d!=0)
  19.                     d++;
  20.                 if(d*d>x && x>1)
  21.                     Nr++;
  22.                 }
  23.         }
  24.      cout<<Nr;
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top