結果

問題 No.3044 April Sum of Odd
ユーザー tomarint2tomarint2
提出日時 2019-04-01 21:30:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 82,560 KB
最終ジャッジ日時 2024-05-04 20:58:30
合計ジャッジ時間 1,361 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,712 KB
testcase_01 AC 36 ms
51,712 KB
testcase_02 AC 36 ms
51,840 KB
testcase_03 AC 47 ms
61,568 KB
testcase_04 AC 53 ms
62,592 KB
testcase_05 AC 57 ms
63,104 KB
testcase_06 AC 60 ms
64,768 KB
testcase_07 AC 53 ms
60,160 KB
testcase_08 AC 54 ms
61,184 KB
testcase_09 AC 62 ms
64,256 KB
testcase_10 AC 68 ms
82,560 KB
testcase_11 AC 62 ms
77,952 KB
testcase_12 AC 38 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
ans=[]
a1=0
cnt=0
for a in A:
    if a%2==1:
        a1+=a
        cnt+=1
    else:
        if a1!=0 and cnt>=M:
            ans.append(a1)
        a1=0
        cnt=0
if a1!=0 and cnt>=M:
    ans.append(a1)
for a in ans:
    print(a)
0