Advertisement
Josif_tepe

Untitled

Jun 3rd, 2024
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int main() {
  6.     int n, m;
  7.     scanf("%d%d", &n, &m);
  8.  
  9.     int mat[n][m];
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < m; j++) {
  12.             scanf("%d", &mat[i][j]);
  13.         }
  14.     }
  15.  
  16.     int brojac = 1;
  17.     int rezultat = 0;
  18.  
  19.     for(int i = 0; i < n; i++) {
  20.         int ok = 1;
  21.         for(int j = 0; j < m; j++) {
  22.             if(mat[i][j] >= brojac && mat[i][j] < brojac * 10) {
  23.  
  24.             }
  25.             else {
  26.                 ok = 0;
  27.             }
  28.         }
  29.         if(ok == 1) {
  30.             rezultat++;
  31.  
  32.             for(int j = 0; j < m; j++) {
  33.                 printf("%d ", mat[i][j]);
  34.             }
  35.             printf("\n");
  36.         }
  37.         brojac *= 10;
  38.     }
  39.     if(rezultat == 0) {
  40.         printf("Nitu edna redica ne go ispolnuva uslovot\n");
  41.     }
  42.     else {
  43.         printf("%d\n", rezultat);
  44.     }
  45.  
  46.  
  47.    
  48. }
  49. /*
  50. 4 4
  51. 1 2 7 9
  52. 17 22 13 10
  53. 26 255 25 124
  54. 1134 1120 5566 9900
  55.  
  56. **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement