Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- int a[n+1][n+1];
- for(int i=0;i<n;i++)
- for(int j=0;j<n;j++)
- cin>>a[i][j];
- int cnt=0;
- for(int i=0;i<n;i++){
- for(int j=0;j<n;j++){
- if (a [i][j] == 0)
- continue;
- bool moze = true;
- for (int k = 0; k < i; k++)
- if (a [k][j] >= a [i][j])
- moze = false;
- if (moze == true){
- cnt++;
- continue;
- }
- moze = true;
- for (int k = i + 1; k < n; k++)
- if (a [k][j] >= a [i][j])
- moze = false;
- if (moze == true){
- cnt++;
- continue;
- }
- moze = true;
- for (int k = 0; k < j; k++)
- if (a [i][k] >= a [i][j])
- moze = false;
- if (moze == true){
- cnt++;
- continue;
- }
- moze = true;
- for (int k = j + 1; k < n; k++)
- if (a [i][k] >= a [i][j])
- moze = false;
- if (moze == true){
- cnt++;
- continue;
- }
- }
- }
- cout<<cnt<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement