Untitled

 avatar
unknown
c_cpp
3 months ago
728 B
4
Indexable
#include <stdio.h>


int contapozzi(int mat[][CMAX], int righe, int colonne)
{
  int is_pozzo;
  int count =0;
  
  for(int i=0; i<righe; i++)
  {
    for(int j=0; j<colonne; j++)
    {
      is_pozzo=1;
      
      int k=0;
      while(k<colonne &&is_pozzo)
      {
        if(mat[i][k] <= mat[i][j] && k!=j)
        {
          is_pozzo = 0; 
        }
        k++;
      }
      
      
      k=0;
      while(k<righe && is_pozzo)
      {
        if(mat[k][j] <= mat[i][j] && k!=i)
        {
          is_pozzo = 0;
        }
        k++;
      }
      
      if(is_pozzo)
      {
        count++;
      }
      
      
    }
  }
  
  return count;
}

int main()
{
    printf("Hello, World!");
}


 8  3  4
-2  1  5
 7  0  6
Editor is loading...
Leave a Comment