結果

問題 No.806 木を道に
ユーザー lumefflux
提出日時 2019-03-23 01:21:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 186 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,328 KB
実行使用メモリ 77,776 KB
最終ジャッジ日時 2024-09-19 08:46:56
合計ジャッジ時間 3,251 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
cnt = [0] * (N + 1)
for _ in range(N - 1):
    a, b = map(int, input().split())
    cnt[a] += 1
    cnt[b] += 1
ans = 0
for c in cnt:
    ans += max(c - 2, 0)
print(ans)
0