結果

問題 No.3044 よくあるカエルさん
ユーザー gew1fw
提出日時 2025-06-12 20:26:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 53,980 KB
最終ジャッジ日時 2025-06-12 20:27:15
合計ジャッジ時間 1,769 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

result = []
current_sum = 0
current_length = 0

for num in a:
    if num % 2 == 1:
        current_sum += num
        current_length += 1
    else:
        if current_length >= m:
            result.append(current_sum)
        current_sum = 0
        current_length = 0

# Check the last run of odd numbers after loop ends
if current_length >= m:
    result.append(current_sum)

for s in result:
    print(s)
0