結果

問題 No.8044 April Sum of Odd
ユーザー iNoma87976671iNoma87976671
提出日時 2019-04-01 22:31:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,704 KB
最終ジャッジ日時 2024-11-27 03:27:53
合計ジャッジ時間 1,128 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
s = list(map(int,input().split()))
ans = []
sum_s = 0
counter = 0
for A in s:
    if A %2 == 1:
        counter += 1
        sum_s += A
        isOdd = True
    else:
        if counter >= M:
            ans.append(sum_s)
        sum_s = 0
        isOdd = False
        counter = 0
if isOdd:
    if counter >= M:
        ans.append(sum_s)

for i in ans:
    if i != 0:
        print(i)
        
0