結果
| 問題 |
No.8044 April Sum of Odd
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-24 19:21:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 618 bytes |
| コンパイル時間 | 1,494 ms |
| コンパイル使用メモリ | 165,592 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-25 17:43:57 |
| 合計ジャッジ時間 | 2,491 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define rep(i, a, n) for (int i = a; i < n; ++i)
int main() {
int n, m;
cin >> n >> m;
int cnt = 0;
ll ans = 0;
rep(i, 0, n) {
int a;
cin >> a;
if (a % 2 == 1) {
cnt++;
ans += a;
} else {
if (cnt >= m) {
cout << ans << endl;
}
cnt = 0;
ans = 0;
}
if (i == n - 1) {
if (cnt >= m) {
cout << ans << endl;
}
}
}
return 0;
}