結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー publflpublfl
提出日時 2021-02-19 21:46:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 32,172 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-15 00:41:51
合計ジャッジ時間 26,689 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,352 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,352 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,348 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,352 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
4,352 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
4,348 KB
testcase_24 WA -
testcase_25 AC 1 ms
4,348 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1 ms
4,348 KB
testcase_29 WA -
testcase_30 AC 2 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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");
}
0