結果
| 問題 |
No.8044 April Sum of Odd
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2019-04-01 22:47:50 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 729 bytes |
| コンパイル時間 | 585 ms |
| コンパイル使用メモリ | 72,400 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 03:44:44 |
| 合計ジャッジ時間 | 1,281 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
int main(void)
{
long n, m;
std::cin >> n >> m;
long sum = 0;
long len = 0;
for(long i = 0; i < n; i++){
long a;
std::cin >> a;
if(a % 2 == 0){
if(sum != 0){
if(m <= len){
std::cout << sum << std::endl;
}
len = 0;
sum = 0;
}
} else {
len++;
sum += a;
}
}
if(sum != 0) {
if(m <= len){
std::cout << sum << std::endl;
}
}
return 0;
}