結果

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

ソースコード

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);
    int 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