結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー kotatsugamekotatsugame
提出日時 2021-02-24 23:59:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 3,153 ms
コード長 400 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 64,880 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 05:28:06
合計ジャッジ時間 30,207 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 22 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 22 ms
4,348 KB
testcase_09 AC 22 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 22 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 22 ms
4,348 KB
testcase_14 AC 22 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 21 ms
4,348 KB
testcase_17 AC 21 ms
4,348 KB
testcase_18 AC 21 ms
4,348 KB
testcase_19 AC 22 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 22 ms
4,348 KB
testcase_22 AC 22 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 22 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 22 ms
4,348 KB
testcase_27 AC 22 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 22 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int H,W,X;
int A[3][3];
main()
{
	cin>>W>>H>>X;
	for(int i=0;i<3;i++)for(int j=0;j<3;j++)
	{
		if(H%3==0?i!=1:H%3==1?i!=0:i==2)continue;
		if(W%3==0?j!=1:W%3==1?j!=0:j==2)continue;
		if(X>9)A[i][j]=9;
		else A[i][j]=X;
		X-=A[i][j];
	}
	if(X)cout<<-1<<endl;
	else
	{
		for(int i=0;i<H;i++)
		{
			for(int j=0;j<W;j++)cout<<A[i%3][j%3];
			cout<<endl;
		}
	}
}
0