結果

問題 No.3044 April Sum of Odd
ユーザー GrayCoderGrayCoder
提出日時 2019-04-01 22:20:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,644 KB
実行使用メモリ 18,904 KB
最終ジャッジ日時 2023-08-18 01:29:25
合計ジャッジ時間 1,223 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,900 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 16 ms
7,792 KB
testcase_03 AC 17 ms
8,636 KB
testcase_04 AC 18 ms
8,972 KB
testcase_05 AC 19 ms
8,804 KB
testcase_06 AC 19 ms
8,984 KB
testcase_07 AC 17 ms
8,124 KB
testcase_08 AC 18 ms
8,724 KB
testcase_09 AC 18 ms
8,900 KB
testcase_10 AC 55 ms
18,904 KB
testcase_11 AC 38 ms
9,900 KB
testcase_12 AC 16 ms
7,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split())) + [0]

    ans, cnt = 0, 0
    for a in A:
        if a % 2:
            cnt += 1
            ans += a
        else:
            if cnt >= M:
                print(ans)
            ans, cnt = 0, 0

input = lambda: stdin.readline()
main()
0