結果

問題 No.806 木を道に
ユーザー ntudantuda
提出日時 2024-01-01 12:41:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 213 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 87,672 KB
最終ジャッジ日時 2024-01-01 12:41:56
合計ジャッジ時間 5,270 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 34 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 34 ms
53,460 KB
testcase_08 AC 34 ms
53,460 KB
testcase_09 AC 35 ms
53,460 KB
testcase_10 AC 87 ms
76,968 KB
testcase_11 AC 83 ms
76,824 KB
testcase_12 AC 133 ms
84,884 KB
testcase_13 AC 126 ms
82,784 KB
testcase_14 AC 133 ms
84,852 KB
testcase_15 AC 132 ms
84,896 KB
testcase_16 AC 92 ms
78,832 KB
testcase_17 AC 136 ms
83,012 KB
testcase_18 AC 75 ms
76,668 KB
testcase_19 AC 85 ms
76,980 KB
testcase_20 AC 127 ms
83,012 KB
testcase_21 AC 111 ms
80,708 KB
testcase_22 AC 158 ms
86,924 KB
testcase_23 AC 150 ms
86,924 KB
testcase_24 AC 108 ms
80,924 KB
testcase_25 AC 132 ms
84,848 KB
testcase_26 AC 93 ms
78,824 KB
testcase_27 AC 146 ms
87,672 KB
testcase_28 AC 66 ms
72,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
UV = [list(map(int, input().split())) for _ in range(N - 1)]
D = [0] * (N + 1)
for u, v in UV:
    D[u] += 1
    D[v] += 1
ans = 0
for i in range(1, N + 1):
    ans += max(D[i] - 2, 0)
print(ans)
0