結果
| 問題 |
No.8044 April Sum of Odd
|
| コンテスト | |
| ユーザー |
SHRIMP_ENG
|
| 提出日時 | 2019-04-01 22:36:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 540 bytes |
| コンパイル時間 | 544 ms |
| コンパイル使用メモリ | 60,864 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-27 03:30:42 |
| 合計ジャッジ時間 | 1,199 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <iostream>
#include <string>
#include <list>
#include <vector>
using namespace std;
int main()
{
int N, M;
cin >> N >> M;
vector<long long int> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
}
long long int S = 0;
int cnt = 0;
for (int i = 0; i < N; i++) {
if (A.at(i) % 2 == 0) {//even
// cout << "even" << endl;
if (cnt >= M) {
cout << S << endl;
}
S = 0;
cnt = 0;
}else{//odd
// cout << "odd" << endl;
cnt++;
S += A.at(i);
}
}
if (cnt >= M) cout << S << endl;
return 0;
}
SHRIMP_ENG