結果

問題 No.8044 April Sum of Odd
ユーザー zaki_chemtech
提出日時 2020-07-10 08:57:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,960 KB
実行使用メモリ 83,364 KB
最終ジャッジ日時 2024-10-09 19:55:30
合計ジャッジ時間 1,790 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

memo_sum = 0

count = 0

anss = []

for i in range(n):
    if a[i]%2 == 1:
        count += 1
        memo_sum += a[i]
    else:
        if m <= count:
            anss.append(memo_sum)
        count = 0
        memo_sum = 0
if m <= count:
    anss.append(memo_sum)

for ans in anss:
    print(ans)
0