Advertisement
a53

Chenar2

a53
Jan 8th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n,m;
  7. cin>>n>>m;
  8. int a[n+1][m+1];
  9. bool ok=false;
  10. for(int i=1;i<=n;++i)
  11. for(int j=1;j<=m;++j)
  12. cin>>a[i][j];
  13. int x;
  14. cin>>x;
  15. for(int i=1;i<=n&&!ok;++i)
  16. if(a[i][1]==x||a[i][m]==x)
  17. ok=true;
  18. for(int j=1;j<=m&&!ok;++j)
  19. if(a[1][j]==x||a[n][j]==x)
  20. ok=true;
  21. if(ok)
  22. cout<<"DA";
  23. else
  24. cout<<"NU";
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement