結果

問題 No.8044 April Sum of Odd
ユーザー DenteDente
提出日時 2019-04-01 21:53:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 80,808 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-26 22:31:23
合計ジャッジ時間 1,326 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#define REP(i,a) for(int i = 0; i < (a); i++)
using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	long long a[n];
	REP(i, n) cin >> a[i];
	int counter = 0;
	long long sum = 0;
	REP(i, n){
		if(a[i] % 2 == 0){
			if(counter >= m)cout << sum << endl;
			sum = 0;
			counter = 0;
		}else{
			sum += a[i];
			counter++;
		}
	}
	if(counter >= m)cout << sum << endl;
}
0