Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<math.h>
- int main() {
- long long int n1, n2;
- while(1) {
- scanf("%lld %lld", &n1, &n2);
- if(n1==0 && n2==0) break;
- int ans, i, j, c, s, g=0, v, c1, c2, c3, c4, arr[n1][n2];
- c=c1=c2=c3=c4=ans=0;
- for(i=0; i<n1; i++) {
- s=v=0;
- for(j=0; j<n2; j++) {
- scanf("%d", &arr[i][j]);
- s+=arr[i][j];
- if(arr[i][j]==1) v=1;
- }
- if(s<n2) g++;
- if(v==1) {
- c2++;
- c++;
- }
- }
- if(g==n1) c1++;
- if(c==n2) c4++;
- for(i=0; i<n2; i++) {
- for(j=0; j<n1; j++) {
- if(arr[i][j]==1) {
- }
- }
- }
- if(c1>0) ans++;
- if(c2>0) ans++;
- if(c3>0) ans++;
- if(c4>0) ans++;
- printf("%d\n", ans);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement