結果

問題 No.3044 April Sum of Odd
ユーザー moririn2528_cmoririn2528_c
提出日時 2019-04-01 21:39:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,124 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 73,260 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 21:20:41
合計ジャッジ時間 1,338 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 36 ms
4,376 KB
testcase_11 AC 16 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<ctime>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

vector<pair<string,string> > v1;

LL s[100005];

int main(){
	int n,m;
	LL a,b,c,d;
	int i,j,k;
	cin>>n>>m;
	for(i=0,b=0,c=0,d=0;i<n;i++){
		cin>>a;
		if(a%2==1)b++,c+=a;
		else{
			if(b>=m)s[d++]=c;
			b=0,c=0;
		}
	}
	if(b>=m)s[d++]=c;
	array_show(s,d,'\n');
}
0