Advertisement
Josif_tepe

Untitled

Feb 8th, 2022
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.     int n, m;
  5.     scanf("%d%d", &n, &m);
  6.    
  7.     int mat[n][m];
  8.     for(int i = 0; i < n; i++) {
  9.         for(int j = 0; j < m; j++) {
  10.             scanf("%d", &mat[i][j]);
  11.         }
  12.     }
  13.     int najgolem_vo_redica;
  14.     int ok;
  15.     for(int i = 0; i < n - 1; i++) {
  16.         najgolem_vo_redica = mat[i][0];
  17.         for(int j = 0; j < m; j++) {
  18.             if(najgolem_vo_redica < mat[i][j]) {
  19.                 najgolem_vo_redica = mat[i][j];
  20.             }
  21.         }
  22.         ok = 1;
  23.        
  24.         for(int j = 0; j < m; j++) {
  25.             if(najgolem_vo_redica < mat[i + 1][j]) {
  26.                 ok = 0;
  27.                 break;
  28.             }
  29.         }
  30.         if(ok == 0) {
  31.             printf("Uslovot ne e ispolnet kaj redica %d\n", i + 2); // i + 1 ni e redicata
  32.             // no nas ni treba redniot broj: (i + 1) + 1
  33.             return 0;
  34.         }
  35.     }
  36.     printf("DA\n");
  37.    
  38.     return 0;
  39. }
  40. /*
  41.  5 4
  42.  1 2 10 0
  43.  7 2 3 1
  44.  8 0 5 4
  45.  4 1 0 1
  46.  2 3 0 0
  47.  
  48.  **/
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement