結果

問題 No.806 木を道に
ユーザー rin204
提出日時 2022-01-19 00:49:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 174 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 82,448 KB
実行使用メモリ 77,500 KB
最終ジャッジ日時 2024-11-23 13:39:09
合計ジャッジ時間 4,228 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

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