結果
| 問題 | No.8044 April Sum of Odd |
| コンテスト | |
| ユーザー |
hamray
|
| 提出日時 | 2019-04-01 21:37:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 740 bytes |
| 記録 | |
| コンパイル時間 | 592 ms |
| コンパイル使用メモリ | 79,776 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-26 21:42:50 |
| 合計ジャッジ時間 | 1,202 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 1 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
#define MAXV 1000000000
#define MOD 1000000007
using ll = long long;
bool operator<(const pair<int, int>& a, const pair<int, int>& b) {
if (a.first == b.first) {
return a.second < b.second;
}
return a.first < b.first;
}
ll a[100010];
int main() {
ll N, M; cin >> N >> M;
for (int i = 0; i < N;++i) cin >> a[i];
ll cnt = 0;
ll sum = 0;
for (int i = 0;i < N; ++i) {
if (a[i] % 2 == 1) {
cnt++;
sum += a[i];
}
else {
if (cnt >= M) {
cout << sum << endl;
}cnt = 0;
sum = 0;
}
}
if (sum) cout << sum << endl;
int aa; cin >> aa;
}
hamray