結果

問題 No.1594 Three Classes
ユーザー pengin_2000pengin_2000
提出日時 2022-08-20 13:14:45
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 29,568 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 00:51:28
合計ジャッジ時間 1,044 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 11 ms
6,940 KB
testcase_05 AC 11 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 11 ms
6,940 KB
testcase_09 AC 13 ms
6,940 KB
testcase_10 AC 11 ms
6,940 KB
testcase_11 AC 11 ms
6,944 KB
testcase_12 AC 11 ms
6,944 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 3 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 1 ms
6,944 KB
testcase_20 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i, j, k;
	int e[16];
	for (i = 0; i < n; i++)
		scanf("%d", &e[i]);
	int p[3];
	int max = 1;
	for (i = 0; i < n; i++, max *= 3);
	for (k = 0; k < max; k++)
	{
		for (i = 0; i < 3; i++)
			p[i] = 0;
		for (j = k, i = 0; i < n; i++, j /= 3)
			p[j % 3] += e[i];
		if (p[0] == p[1] && p[1] == p[2])
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}
0