結果
問題 |
No.1398 調和の魔法陣 (構築)
|
ユーザー |
![]() |
提出日時 | 2021-02-19 21:31:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 603 bytes |
コンパイル時間 | 2,158 ms |
コンパイル使用メモリ | 197,024 KB |
最終ジャッジ日時 | 2025-01-18 23:13:24 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 16 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000 int main(){ int W,H,X; cin>>W>>H>>X; if(W%3!=2||H%3!=2){ cout<<-1<<endl; return 0; } if(X>36){ cout<<-1<<endl; } vector<int> cnt(4,0); rep(i,4){ if(X<=9){ cnt[i] = X; break; } else{ cnt[i] = 9; X -= 9; } } vector<string> ans(H,string(W,'0')); rep(i,H){ rep(j,W){ int x = i%3,y = j%3; if(x<=1&&y<=1){ ans[i][j] = '0' + (cnt[x*2+y]); } } } rep(i,H){ cout<<ans[i]<<endl; } return 0; }