結果
| 問題 |
No.1398 調和の魔法陣 (構築)
|
| コンテスト | |
| ユーザー |
publfl
|
| 提出日時 | 2021-02-19 21:46:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 32,512 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-16 18:14:53 |
| 合計ジャッジ時間 | 25,654 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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<=b;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");
}
publfl