#include <stdio.h>
#include <stdlib.h>
//必要があれば変数などを追加してもOKです
int main(){
int i, j;
int a, b;
int **mat;
int cnt = 1;
// 2次元配列の動的確保
mat
= (int **)malloc(sizeof(int *) * a
); for (i = 0; i < a; i++) {
mat
[i
] = (int *)malloc(sizeof(int) * b
); }
// 2次元配列に数値を代入(1,2,3,...)
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
mat[i][j] = cnt++;
}
}
// 表示部分
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
}
}
// 動的確保したメモリの解放
for (i = 0; i < a; i++) {
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCi8v5b+F6KaB44GM44GC44KM44Gw5aSJ5pWw44Gq44Gp44KS6L+95Yqg44GX44Gm44KCT0vjgafjgZkKCmludCBtYWluKCl7CiAgICBpbnQgaSwgajsKICAgIGludCBhLCBiOwogICAgaW50ICoqbWF0OwogICAgaW50IGNudCA9IDE7CgogICAgc2NhbmYoIiVkICVkIiwgJmEsICZiKTsKCiAgICAvLyAy5qyh5YWD6YWN5YiX44Gu5YuV55qE56K65L+dCiAgICBtYXQgPSAoaW50ICoqKW1hbGxvYyhzaXplb2YoaW50ICopICogYSk7CiAgICBmb3IgKGkgPSAwOyBpIDwgYTsgaSsrKSB7CiAgICAgICAgbWF0W2ldID0gKGludCAqKW1hbGxvYyhzaXplb2YoaW50KSAqIGIpOwogICAgfQoKICAgIC8vIDLmrKHlhYPphY3liJfjgavmlbDlgKTjgpLku6PlhaXvvIgxLDIsMywuLi7vvIkKICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBmb3IgKGogPSAwOyBqIDwgYjsgaisrKSB7CiAgICAgICAgICAgIG1hdFtpXVtqXSA9IGNudCsrOwogICAgICAgIH0KICAgIH0KCiAgICAvLyDooajnpLrpg6jliIYKICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBmb3IgKGogPSAwOyBqIDwgYjsgaisrKSB7CiAgICAgICAgICAgIHByaW50ZigiJWQgIiwgbWF0W2ldW2pdKTsKICAgICAgICB9CiAgICAgICAgcHJpbnRmKCJcbiIpOwogICAgfQoKICAgIC8vIOWLleeahOeiuuS/neOBl+OBn+ODoeODouODquOBruino+aUvgogICAgZm9yIChpID0gMDsgaSA8IGE7IGkrKykgewogICAgICAgIGZyZWUobWF0W2ldKTsKICAgIH0KICAgIGZyZWUobWF0KTsKCiAgICByZXR1cm4gMDsKfQ==