結果

問題 No.99 ジャンピング駒
ユーザー nanaenanae
提出日時 2017-01-05 10:34:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 502 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,592 KB
実行使用メモリ 18,908 KB
最終ジャッジ日時 2023-08-22 12:22:19
合計ジャッジ時間 1,511 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
18,836 KB
testcase_01 AC 64 ms
18,804 KB
testcase_02 AC 65 ms
18,816 KB
testcase_03 AC 63 ms
18,768 KB
testcase_04 AC 67 ms
18,908 KB
testcase_05 AC 61 ms
18,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# yukicoder No.99 ジャンピング駒

N = int(input())
X = [int(x) for x in input().split()]

'''
偶奇が異なる駒同士は消滅させることができる
一方、偶奇が一致している駒同士はどうやっても消すことができない
故に偶数の駒の数と奇数の駒の数の差の絶対値が
最後まで残る駒の数の最小値である
'''

num_even = 0

for i in X:
    if i % 2 == 0:
        num_even += 1

num_odd = N - num_even

print(abs(num_even - num_odd))
0