結果

問題 No.806 木を道に
ユーザー silversmith
提出日時 2019-03-31 16:47:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 225 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 42,188 KB
最終ジャッジ日時 2024-11-21 20:27:01
合計ジャッジ時間 6,788 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
E = [input().split(' ') for i in range(N - 1)]
d = {}
for e in E:
    d[e[0]] = d[e[0]] + 1 if e[0] in d else 1
    d[e[1]] = d[e[1]] + 1 if e[1] in d else 1

print(sum([max(d[x] -2 , 0) for x in d.keys()]))
0