#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int m[660][660]; int b1[10] = { 0,0,0,1,1,1,-1,-1,-1 }; int b2[10] = { 0,1,-1,0,1,-1,0,1,-1 }; int main() { int w, h, x; cin >> w >> h >> x; if (x == 0) { for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cout << 0; } cout << endl; } return 0; } if (h == 1 && w == 1) { if (x > 9) { cout << -1 << endl; } else { cout << x << endl; } } else if (h == 1) { if (x > 18) { cout << -1 << endl; } else { for (int i = 0; i < w; i++) { if (i % 3 == 0) { cout << x / 9 * 9; } else if (i % 3 == 1) { cout << x % 9; } else { cout << 0; } } cout << endl; } } else if (w == 1) { if (x > 18) { cout << -1 << endl; } else { for (int i = 0; i < h; i++) { if (i % 3 == 0) { cout << x / 9 * 9 << endl; } else if (i % 3 == 1) { cout << x % 9 << endl; } else { cout << 0 << endl; } } } } else { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == x) { for (int a = 0; a < h; a++) { for (int b = 0; b < w; b++) { if (a % 3 == 0 && b % 3 == 0) { m[a][b] = i; } else if (a % 3 == 1 && b % 3 == 0) { m[a][b] = j; } else if (a % 3 == 0 && b % 3 == 1) { m[a][b] = k; } else if (a % 3 == 1 && b % 3 == 1) { m[a][b] = l; } else { m[a][b] = 0; } } } bool bo = true; for (int a = 0; a < h; a++) { for (int b = 0; b < w; b++) { int co = 0; for (int c = 0; c < 9; c++) { if (a + b1[c] < 0 || a + b1[c] >= h || b + b2[c] < 0 || b + b2[c] >= w)continue; else co += m[a + b1[c]][b + b2[c]]; } if (co != x)bo = false; } } if (bo) { for (int a = 0; a < h; a++) { for (int b = 0; b < w; b++) { cout << m[a][b]; } cout << endl; } return 0; } } } } } } cout << -1 << endl; } }