Question:
Solution:
char mat[105][105];
int N;
int row() {
int i,j,sum,c,save;
sum = 0;
c = 0;
for(i = 0; i<N; i ++) {
sum = 0;
for(j = 0; j<N; j ++)
sum += mat[i][j];
if( sum % 2 != 0) {
c ++;
save = i;
}
if( c>1) return -2;
}
if( c == 1) return save;
return -1;
}
int column() {
int i,j,sum,c,save;
sum = c = 0;
for(i = 0; i<N; i ++) {
sum = 0;
for(j = 0; j<N; j ++)
sum += mat[j][i];
if(sum % 2 != 0) {
c ++;
save = i;
}
if(c > 1) return -2;
}
if( c == 1) return save;
return -1;
}
int main(){
......
......
......
}
No comments:
Post a Comment