結果
問題 |
No.1398 調和の魔法陣 (構築)
|
ユーザー |
![]() |
提出日時 | 2021-02-19 21:49:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 32,768 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-16 18:24:18 |
合計ジャッジ時間 | 26,214 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 9 WA * 19 |
ソースコード
#include <stdio.h> int ans[5][5]; int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) ans[i][j] = -1; if(a%3==0) ans[1][1] = ans[2][1] = 0; if(a%3==1) ans[1][2] = ans[2][2] = 0; if(b%3==0) ans[1][1] = ans[1][2] = 0; if(b%3==1) ans[2][1] = ans[2][2] = 0; for(int i=1;i<=2&&i<=b;i++) { for(int j=1;j<=2&&j<=a;j++) { if(ans[i][j]==-1) { ans[i][j] = c<9?c:9; c -= ans[i][j]; } } } if(c>0) printf("-1"); else { for(int i=1;i<=b;i++) { for(int j=1;j<=a;j++) { printf("%d",ans[i%3][j%3]); } printf("\n"); } } printf("\n"); }