結果

問題 No.3044 April Sum of Odd
ユーザー tsuyoiboytsuyoiboy
提出日時 2019-04-14 12:32:32
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 11,972 KB
実行使用メモリ 21,064 KB
最終ジャッジ日時 2023-10-18 22:31:10
合計ジャッジ時間 1,651 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,156 KB
testcase_01 AC 29 ms
10,156 KB
testcase_02 AC 30 ms
10,156 KB
testcase_03 AC 33 ms
10,800 KB
testcase_04 AC 34 ms
10,996 KB
testcase_05 AC 35 ms
10,848 KB
testcase_06 AC 35 ms
11,136 KB
testcase_07 AC 30 ms
10,456 KB
testcase_08 AC 33 ms
10,788 KB
testcase_09 AC 35 ms
10,944 KB
testcase_10 AC 93 ms
21,064 KB
testcase_11 AC 68 ms
11,964 KB
testcase_12 AC 30 ms
10,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=[int(i) for i in input().split()]
streak=0
wa=0
odds=[]
for a in A:
    if a%2:#odd
        if streak==0:
            streak+=1
            wa+=a
        else:
            streak+=1
            wa+=a
    else:
        if streak>=M:
            print(wa)
        streak=0
        wa=0
if streak>=M:print(wa)
        
0