結果

問題 No.8044 April Sum of Odd
ユーザー KKT89
提出日時 2020-07-13 15:26:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 764 bytes
コンパイル時間 956 ms
コンパイル使用メモリ 109,108 KB
最終ジャッジ日時 2025-01-11 20:15:31
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
using ull = unsigned long long;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    a.push_back(0LL);
    ll now=0;
    ll sum=0;
    for(int i=0;i<=n;i++){
        if(a[i]%2==0){
            if(now>=m){
                printf("%lld\n",sum );
            }
            now=0;
            sum=0;
        }
        else{
            now++;
            sum+=a[i];
        }
    }
}
0