結果
| 問題 |
No.8044 April Sum of Odd
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-01 21:53:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 355 bytes |
| コンパイル時間 | 2,236 ms |
| コンパイル使用メモリ | 195,944 KB |
| 最終ジャッジ日時 | 2025-01-07 01:00:46 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n);
for (auto &e : a) cin >> e;
a.push_back(0);
ll s = 0;
int k = 0;
for (auto e : a) {
if (e % 2) {
s += e;
k++;
} else {
if (k >= m) cout << s << endl;
s = 0;
k = 0;
}
}
}