#include <stdio.h>
#include <stdlib.h>
int main(){
int i, j, count = 1;
int a, b;
int **mat;
// 2次元配列の動的確保
mat
= (int **)malloc(a
* sizeof(int *)); for(i = 0; i < a; i++){
mat
[i
] = (int *)malloc(b
* sizeof(int)); }
// 2次元配列に数値を代入する
for(i = 0; i < a; i++){
for(j = 0; j < b; j++){
mat[i][j] = count++;
}
}
// 表示
for(i = 0; i < a; i++){
for(j = 0; j < b; j++){
}
}
// 動的に確保したメモリの解放
for(i = 0; i < a; i++){
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KIAppbnQgbWFpbigpewogICAgaW50IGksIGosIGNvdW50ID0gMTsKICAgIGludCBhLCBiOwogICAgaW50ICoqbWF0OwogICAgc2NhbmYoIiVkICVkIiwgJmEsICZiKTsKIAogICAgLy8gMuasoeWFg+mFjeWIl+OBruWLleeahOeiuuS/nQogICAgbWF0ID0gKGludCAqKiltYWxsb2MoYSAqIHNpemVvZihpbnQgKikpOwogICAgZm9yKGkgPSAwOyBpIDwgYTsgaSsrKXsKICAgICAgICBtYXRbaV0gPSAoaW50ICopbWFsbG9jKGIgKiBzaXplb2YoaW50KSk7CiAgICB9CiAKICAgIC8vIDLmrKHlhYPphY3liJfjgavmlbDlgKTjgpLku6PlhaXjgZnjgosKICAgIGZvcihpID0gMDsgaSA8IGE7IGkrKyl7CiAgICAgICAgZm9yKGogPSAwOyBqIDwgYjsgaisrKXsKICAgICAgICAgICAgbWF0W2ldW2pdID0gY291bnQrKzsKICAgICAgICB9CiAgICB9CiAKICAgIC8vIOihqOekugogICAgZm9yKGkgPSAwOyBpIDwgYTsgaSsrKXsKICAgICAgICBmb3IoaiA9IDA7IGogPCBiOyBqKyspewogICAgICAgICAgICBwcmludGYoIiVkICIsIG1hdFtpXVtqXSk7CiAgICAgICAgfQogICAgICAgIHByaW50ZigiXG4iKTsKICAgIH0KIAogICAgLy8g5YuV55qE44Gr56K65L+d44GX44Gf44Oh44Oi44Oq44Gu6Kej5pS+CiAgICBmb3IoaSA9IDA7IGkgPCBhOyBpKyspewogICAgICAgIGZyZWUobWF0W2ldKTsKICAgIH0KICAgIGZyZWUobWF0KTsKIAogICAgcmV0dXJuIDA7Cn0=