結果
問題 | No.8044 April Sum of Odd |
ユーザー |
|
提出日時 | 2019-04-01 22:21:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 584 bytes |
コンパイル時間 | 1,749 ms |
コンパイル使用メモリ | 165,904 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 03:15:42 |
合計ジャッジ時間 | 2,113 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include "bits/stdc++.h"using namespace std;typedef long long ll;#define INF (1<<30)#define INFLL (1ll<<60)typedef pair<int, int> P;typedef pair<int, P> E;#define MOD (1000000007ll)#define l_ength sizevoid mul_mod(ll& a, ll b){a *= b;a %= MOD;}void add_mod(ll& a, ll b){a += b;if(a>MOD){a -= MOD;}}ll a,s;int main(void){int n,m,cnt=0,i;cin >> n >> m;for(i=0; i<n; ++i){cin >> a;if(a%2){++cnt;s += a;}else{if(cnt>=m){cout << s << endl;}cnt = 0;s = 0ll;}}if(cnt>=m){cout << s << endl;}return 0;}