#include <stdio.h>
#include <stdlib.h>
int main() {
int i, j, k = 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] = k++;
}
}
// 配列を表示
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
}
}
// 動的メモリの解放
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBtYWluKCkgewogICAgaW50IGksIGosIGsgPSAxOwogICAgaW50IGEsIGI7CiAgICBpbnQgKiptYXQ7CgogICAgLy8g6KGM5YiX44Gu44K144Kk44K644KS5YWl5YqbCiAgICBzY2FuZigiJWQgJWQiLCAmYSwgJmIpOwoKICAgIC8vIDLmrKHlhYPphY3liJfjga7li5XnmoTnorrkv50KICAgIG1hdD0oaW50KiopbWFsbG9jKGEqc2l6ZW9mKGludCopKTsgLy8g6KGM44KS56K65L+dCiAgICAJCiAgICBmb3IoaT0wO2k8YTtpKyspIHsKICAgICAgICBtYXRbaV09KGludCopbWFsbG9jKGIqc2l6ZW9mKGludCkpOyAvLyDlkITooYzjgavliJfjgpLnorrkv50KICAgICAgICAJCiAgICB9CgogICAgLy8gMuasoeWFg+mFjeWIl+OBq+aVsOWApOOCkuS7o+WFpQogICAgZm9yIChpID0gMDsgaSA8IGE7IGkrKykgewogICAgICAgIGZvciAoaiA9IDA7IGogPCBiOyBqKyspIHsKICAgICAgICAgICAgbWF0W2ldW2pdID0gaysrOwogICAgICAgIH0KICAgIH0KCiAgICAvLyDphY3liJfjgpLooajnpLoKICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBmb3IgKGogPSAwOyBqIDwgYjsgaisrKSB7CiAgICAgICAgICAgIHByaW50ZigiJWQgIiwgbWF0W2ldW2pdKTsKICAgICAgICB9CiAgICAgICAgcHJpbnRmKCJcbiIpOwogICAgfQoKICAgIC8vIOWLleeahOODoeODouODquOBruino+aUvgogICAKICAgIHJldHVybiAwOwp9Cg==