結果

問題 No.8044 April Sum of Odd
ユーザー もりをもりを
提出日時 2019-04-01 21:43:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,604 KB
最終ジャッジ日時 2024-11-26 22:07:06
合計ジャッジ時間 1,360 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
a = list(map(int,input().split()))

cnt = 0
res = 0
for i in a:
    if i % 2 == 0:
        if res > 0 and cnt >= m:
            print(res)
        res = 0
        cnt = 0
    else:
        res += i
        cnt += 1
else:
    if res != 0 and cnt >= m:
        print(res)
0