結果
問題 | No.1398 調和の魔法陣 (構築) |
ユーザー |
![]() |
提出日時 | 2021-02-19 21:39:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 3,153 ms |
コード長 | 898 bytes |
コンパイル時間 | 2,249 ms |
コンパイル使用メモリ | 196,900 KB |
最終ジャッジ日時 | 2025-01-18 23:24:44 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int w, h, x; cin >> w >> h >> x; int v = 1; if (w % 3 == 2) { v *= 2; } if (h % 3 == 2) { v *= 2; } if (x > 9 * v) { cout << -1 << endl; return 0; } vector<vector<int>> pattern(3, vector<int>(3)); for (int i = 0; i < 2; i++) { if (i % 3 == h % 3) { continue; } for (int j = 0; j < 2; j++) { if (j % 3 == w % 3) { continue; } pattern.at(i).at(j) = min(x, 9); x -= pattern.at(i).at(j); } } for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cout << pattern.at(i % 3).at(j % 3); } cout << endl; } return 0; }