#include <stdio.h>
#include <stdlib.h>
// 必要があれば変数などを追加してもOKです
int main(){
int i, j, k;
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次元配列に数値を代入する
k = 1; // 自然数の初期値
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
mat[i][j] = k++;
}
}
// 以下の部分は表示の部分です
// いじらなくてOK
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
}
}
// 最後に忘れずにすることと言えば?
// 動的に確保したメモリを解放
for (i = 0; i < a; i++) {
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCi8vIOW/heimgeOBjOOBguOCjOOBsOWkieaVsOOBquOBqeOCkui/veWKoOOBl+OBpuOCgk9L44Gn44GZCgppbnQgbWFpbigpewogICAgaW50IGksIGosIGs7CiAgICBpbnQgYSwgYjsKICAgIGludCAqKm1hdDsKCiAgICAvLyDooYzmlbDjgajliJfmlbDjgpLlhaXlipsKICAgIHNjYW5mKCIlZCAlZCIsICZhLCAmYik7CgogICAgLy8g44GT44GT44GnMuasoeWFg+mFjeWIl+OBruWLleeahOeiuuS/neOCkuOBmeOCiwogICAgbWF0ID0gKGludCAqKiltYWxsb2MoYSAqIHNpemVvZihpbnQgKikpOyAvLyDooYzjga7jg6Hjg6Ljg6rjgpLnorrkv50KICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBtYXRbaV0gPSAoaW50ICopbWFsbG9jKGIgKiBzaXplb2YoaW50KSk7IC8vIOWQhOihjOOBq+WIl+OBruODoeODouODquOCkueiuuS/nQogICAgfQoKICAgIC8vIOOBk+OBk+OBpzLmrKHlhYPphY3liJfjgavmlbDlgKTjgpLku6PlhaXjgZnjgosKICAgIGsgPSAxOyAvLyDoh6rnhLbmlbDjga7liJ3mnJ/lgKQKICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBmb3IgKGogPSAwOyBqIDwgYjsgaisrKSB7CiAgICAgICAgICAgIG1hdFtpXVtqXSA9IGsrKzsKICAgICAgICB9CiAgICB9CgogICAgLy8g5Lul5LiL44Gu6YOo5YiG44Gv6KGo56S644Gu6YOo5YiG44Gn44GZCiAgICAvLyDjgYTjgZjjgonjgarjgY/jgaZPSwogICAgZm9yIChpID0gMDsgaSA8IGE7IGkrKykgewogICAgICAgIGZvciAoaiA9IDA7IGogPCBiOyBqKyspIHsKICAgICAgICAgICAgcHJpbnRmKCIlZCAiLCBtYXRbaV1bal0pOwogICAgICAgIH0KICAgICAgICBwcmludGYoIlxuIik7CiAgICB9CgogICAgLy8g5pyA5b6M44Gr5b+Y44KM44Ga44Gr44GZ44KL44GT44Go44Go6KiA44GI44Gw77yfCiAgICAvLyDli5XnmoTjgavnorrkv53jgZfjgZ/jg6Hjg6Ljg6rjgpLop6PmlL4KICAgIGZvciAoaSA9IDA7IGkgPCBhOyBpKyspIHsKICAgICAgICBmcmVlKG1hdFtpXSk7CiAgICB9CiAgICBmcmVlKG1hdCk7CgogICAgcmV0dXJuIDA7Cn0K