結果

問題 No.1852 Divide or Reduce
ユーザー 👑 ygussanyygussany
提出日時 2022-02-25 21:59:14
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 514 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 28,732 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 16:52:32
合計ジャッジ時間 3,968 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 65 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 65 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 59 ms
4,376 KB
testcase_20 AC 92 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int solve(int N, int A[])
{
	int i, flag = 0;
	long long sum = 0;
	for (i = 1; i <= N; i++) {
		if (A[i] == 1) flag = 1;
		sum += A[i] - 1;
	}
	if (flag != 0) return sum % 2;
	if (sum % 2 != 0 || N % 2 == 0) return 1;
	else return 0;
}

int main()
{
	int i, t, T, N, A[200001];
	scanf("%d", &T);
	for (t = 1; t <= T; t++) {
		scanf("%d", &N);
		for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
		if (solve(N, A) == 0) printf("Second\n");
		else printf("First\n");
	}
	fflush(stdout);
	return 0;
}
0