結果
| 問題 |
No.8044 April Sum of Odd
|
| ユーザー |
nadeshino
|
| 提出日時 | 2020-05-19 18:10:45 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 528 bytes |
| コンパイル時間 | 3,714 ms |
| コンパイル使用メモリ | 65,448 KB |
| 実行使用メモリ | 6,912 KB |
| 最終ジャッジ日時 | 2024-10-01 22:56:04 |
| 合計ジャッジ時間 | 4,402 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
import sequtils, strutils
let read* = iterator: string =
while true: (for s in stdin.readLine.split: yield s)
template input*(T: static[typedesc]): untyped =
when T is int: read().parseInt
elif T is float: read().parseFloat
elif T is string: read()
elif T is char: read()[0]
let N, M = input(int)
let A = newSeqWith(N, input(int)) & @[0]
var res = newSeq[int]()
var cnt, sum = 0
for a in A:
if (a and 1) == 1:
inc cnt; sum += a
else:
if cnt >= M: res.add(sum)
cnt = 0; sum = 0
echo res.join("\n")
nadeshino