結果
問題 | No.8044 April Sum of Odd |
ユーザー |
![]() |
提出日時 | 2019-04-01 21:24:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 980 bytes |
コンパイル時間 | 985 ms |
コンパイル使用メモリ | 90,564 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 10:58:23 |
合計ジャッジ時間 | 1,417 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <cstdio>#include <iostream>#include <string>#include <sstream>#include <stack>#include <algorithm>#include <cmath>#include <queue>#include <map>#include <set>#include <cstdlib>#include <bitset>template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }char ToUpper(char cX) { return toupper(cX); }char Tolower(char cX) { return tolower(cX); }const long long INF = 1LL << 60;const long long MOD = 1000000007;using namespace std;typedef unsigned long long ull;typedef long long ll;vector<ll> dp;int main(){ll n, m;cin >> n >> m;ll sum = 0;ll flag = 0;for (ll i = 0; i < n; i++) {ll temp;cin >> temp;if (temp % 2 == 1) {flag++;sum += temp;}else {if (flag >= m) {cout << sum << endl;}flag = 0;sum = 0;}}if (flag >= m) {cout << sum << endl;}return 0;}