結果

問題 No.8044 April Sum of Odd
ユーザー Raff
提出日時 2022-03-07 15:40:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 1,483 ms
コンパイル使用メモリ 169,360 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 10:33:30
合計ジャッジ時間 2,224 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    for (auto &a : A)
        cin >> a;
    A.push_back(0);
    ll cnt = 0, tot = 0;
    for (auto &a : A)
    {
        if (a & 1 == 1)
        {
            cnt++;
            tot += a;
        }
        else
        {
            if (cnt >= M)
                cout << tot << endl;
            cnt = 0;
            tot = 0;
        }
    }
}
0