Advertisement
Josif_tepe

Untitled

Apr 23rd, 2024
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int n, m;
  6.     scanf("%d%d", &n, &m);
  7.  
  8.     int mat[n][m];
  9.     for(int i = 0; i < n; i++) {
  10.         for(int j = 0; j < m; j++) {
  11.             scanf("%d", &mat[i][j]);
  12.         }
  13.     }
  14.  
  15.     for(int i = 0; i < n; i++) {
  16.         int zbir = 0;
  17.         for(int j = 1; j < m; j++) {
  18.             zbir += mat[i][j];
  19.         }
  20.         if(mat[i][0] == zbir) {
  21.             printf("%d\n", mat[i][0]);
  22.         }
  23.     }
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement