結果

問題 No.3044 April Sum of Odd
ユーザー hir355hir355
提出日時 2020-04-11 20:40:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 246 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 11,788 KB
実行使用メモリ 20,792 KB
最終ジャッジ日時 2023-10-19 14:26:57
合計ジャッジ時間 2,460 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,064 KB
testcase_01 AC 30 ms
10,064 KB
testcase_02 AC 33 ms
10,064 KB
testcase_03 AC 35 ms
10,700 KB
testcase_04 AC 37 ms
10,904 KB
testcase_05 AC 35 ms
10,764 KB
testcase_06 AC 37 ms
11,044 KB
testcase_07 AC 32 ms
10,364 KB
testcase_08 AC 37 ms
10,688 KB
testcase_09 AC 37 ms
10,844 KB
testcase_10 AC 100 ms
20,792 KB
testcase_11 AC 93 ms
11,856 KB
testcase_12 AC 29 ms
10,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(int, input().split()))
l = 0
while l < n:
    s = 0
    r = l
    while r < n and a[r] % 2:
        s += a[r]
        r += 1
    if r - l >= m:
        print(s)
        l = r
    else:
        l += 1
0