結果

問題 No.806 木を道に
ユーザー むらため
提出日時 2019-05-17 22:10:13
言語 Nim
(2.2.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 2,331 ms
コンパイル使用メモリ 61,748 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 01:32:33
合計ジャッジ時間 3,599 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils
template times*(n:int,body) = (for _ in 0..<n: body)
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" ,discardable.}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': return
    result = 10 * result + k.ord - '0'.ord

let n = scan()
# 木やんけ
# ∑3回以上登場しているもの-2
var E = newSeq[int](n+1)
(2*n-2).times: E[scan()] += 1
var ans = 0
for e in E: ans += 0.max(e-2)
echo ans
0