Advertisement
Plabon_dutta

1514

Jan 11th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<math.h>
  4.  
  5. int main() {
  6. long long int n1, n2;
  7. while(1) {
  8. scanf("%lld %lld", &n1, &n2);
  9. if(n1==0 && n2==0) break;
  10. int ans, i, j, c, s, g=0, v, c1, c2, c3, c4, arr[n1][n2];
  11. c=c1=c2=c3=c4=ans=0;
  12. for(i=0; i<n1; i++) {
  13. s=v=0;
  14. for(j=0; j<n2; j++) {
  15. scanf("%d", &arr[i][j]);
  16. s+=arr[i][j];
  17. if(arr[i][j]==1) v=1;
  18. }
  19. if(s<n2) g++;
  20. if(v==1) {
  21. c2++;
  22. c++;
  23. }
  24. }
  25. if(g==n1) c1++;
  26. if(c==n2) c4++;
  27. for(i=0; i<n2; i++) {
  28. for(j=0; j<n1; j++) {
  29. if(arr[i][j]==1) {
  30.  
  31. }
  32. }
  33. }
  34. if(c1>0) ans++;
  35. if(c2>0) ans++;
  36. if(c3>0) ans++;
  37. if(c4>0) ans++;
  38. printf("%d\n", ans);
  39.  
  40. }
  41.  
  42. return 0;
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement