結果

問題 No.8044 April Sum of Odd
ユーザー 👑 CleyL
提出日時 2019-04-01 23:05:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 59,736 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 04:07:00
合計ジャッジ時間 1,007 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n,m;cin>>n>>m;
    int nw = 0;
    long long wa = 0;
    vector<long long> arr;
    for(int i = 0; n >= i; i++){
        int tmp;
        if(i != n)cin>>tmp;
        else tmp = 2;
        if(tmp % 2 == 1){
            nw++;
            wa += tmp;
        }else{
            if(nw >= m){
                arr.push_back(wa);
            }
            wa = 0;
            nw = 0;
        }
    }
    for(int i = 0; arr.size() > i; i++){
        cout << arr[i] << endl;
    }
}
0