結果
| 問題 |
No.8044 April Sum of Odd
|
| コンテスト | |
| ユーザー |
ramia777
|
| 提出日時 | 2022-04-22 11:28:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 1,287 bytes |
| コンパイル時間 | 956 ms |
| コンパイル使用メモリ | 94,308 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 16:18:28 |
| 合計ジャッジ時間 | 1,497 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
//
// Yukicoder
// No.3044 April sum of Odd
//
//
//
//
//#include "stdafx.h"
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>//list
#include <set> //tree
#include <map> //連想配列
#include <unordered_set> //hash
#include <unordered_map> //hash
#include <algorithm>
#include <iomanip>
#include <string>
#include <stdlib.h>
using namespace std;
typedef unsigned long long ULL;
typedef signed long long SLL;
typedef unsigned int UINT;
#define START (0)
#define RIGHT (1)
#define UP (2)
#define LEFT (3)
#define DOWN (4)
#define DATA_MAX (1000000)
#define FMAX(a,b) ((a)>(b)?(a):(b))
#define FMIN(a,b) ((a)<(b)?(a):(b))
vector <vector <SLL>> memo2;//二次元可変配列
vector<SLL> memo1;
vector<SLL> c;
vector<SLL> v;
vector<SLL> dp;
SLL H ,A, B, T, F, N, M, Result;
UINT hashtable;
int main(int argc, char *argv[])
{
SLL a[100000];
cin >> N;
cin >> M;
for (int i = 0; i < N; i++)
{
cin >> a[i];
}
SLL sum = 0;
SLL count = 0;
for(SLL i=0;i<N;i++)
{
if (a[i] % 2)
{
sum += a[i];
count++;
}
else
{
if (count >= M)
cout << sum << endl;
count = 0;
sum = 0;
}
}
if (count >= M)
cout << sum << endl;
///////////////////
//cout << endl;
//getchar();
return 0; //end
}
ramia777