結果
| 問題 |
No.8044 April Sum of Odd
|
| コンテスト | |
| ユーザー |
cedretaber
|
| 提出日時 | 2019-04-01 21:29:22 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 492 bytes |
| コンパイル時間 | 1,127 ms |
| コンパイル使用メモリ | 107,200 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-13 04:41:54 |
| 合計ジャッジ時間 | 2,050 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto nm = readln.split.to!(int[]);
auto N = nm[0];
auto M = nm[1];
auto AS = readln.split.to!(long[]);
long s;
int c;
foreach (a; AS) {
if (a%2 == 1) {
++c;
s += a;
} else if (s) {
if (c >= M) writeln(s);
s = 0;
c = 0;
}
}
if (s && c >= M) writeln(s);
}
cedretaber