#include <stdio.h>
#include <stdlib.h>
int main(void) {
int a,b,i,j,k,**mat;
mat
=(int**)malloc(sizeof(int*)*a
); for(i
=0;i
<a
;i
++) mat
[i
]=(int*)malloc(sizeof(int)*b
);
if(mat==NULL){
return 0;
}
k=1;
for(i=0;i<a;i++){
for(j=0;j<b;j++) mat[i][j]=k++;
}
for(i=0;i<a;i++){
for(j
=0;j
<b
;j
++) printf("%d ",mat
[i
][j
]); }
for(i
=0;i
<a
;i
++) free(mat
[i
]);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBtYWluKHZvaWQpIHsKCWludCBhLGIsaSxqLGssKiptYXQ7CglzY2FuZigiJWQgJWQiLCZhLCZiKTsKCQoJbWF0PShpbnQqKiltYWxsb2Moc2l6ZW9mKGludCopKmEpOwoJZm9yKGk9MDtpPGE7aSsrKSBtYXRbaV09KGludCopbWFsbG9jKHNpemVvZihpbnQpKmIpOwoJCglpZihtYXQ9PU5VTEwpewoJCXByaW50ZigiRVJST1JcbiIpOwoJCXJldHVybiAwOwoJfQoJCglrPTE7Cglmb3IoaT0wO2k8YTtpKyspewoJCWZvcihqPTA7ajxiO2orKykgbWF0W2ldW2pdPWsrKzsKCX0KCQoJZm9yKGk9MDtpPGE7aSsrKXsKCQlmb3Ioaj0wO2o8YjtqKyspIHByaW50ZigiJWQgIixtYXRbaV1bal0pOwoJCXByaW50ZigiXG4iKTsKCX0KCQoJZm9yKGk9MDtpPGE7aSsrKSBmcmVlKG1hdFtpXSk7CglmcmVlKG1hdCk7CgkKCXJldHVybiAwOwp9Cg==