結果

問題 No.806 木を道に
ユーザー TakoKurageTakoKurage
提出日時 2019-03-22 21:53:54
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 340 ms / 2,000 ms
コード長 189 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 11,656 KB
実行使用メモリ 10,584 KB
最終ジャッジ日時 2023-10-19 09:04:29
合計ジャッジ時間 5,291 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,924 KB
testcase_01 AC 29 ms
9,924 KB
testcase_02 AC 30 ms
9,924 KB
testcase_03 AC 30 ms
9,924 KB
testcase_04 AC 30 ms
9,924 KB
testcase_05 AC 30 ms
9,924 KB
testcase_06 AC 30 ms
9,924 KB
testcase_07 AC 29 ms
9,924 KB
testcase_08 AC 30 ms
9,924 KB
testcase_09 AC 29 ms
9,924 KB
testcase_10 AC 92 ms
10,056 KB
testcase_11 AC 86 ms
10,056 KB
testcase_12 AC 275 ms
10,320 KB
testcase_13 AC 210 ms
10,320 KB
testcase_14 AC 264 ms
10,320 KB
testcase_15 AC 281 ms
10,584 KB
testcase_16 AC 120 ms
10,056 KB
testcase_17 AC 248 ms
10,320 KB
testcase_18 AC 55 ms
10,004 KB
testcase_19 AC 98 ms
10,056 KB
testcase_20 AC 247 ms
10,320 KB
testcase_21 AC 153 ms
10,056 KB
testcase_22 AC 320 ms
10,584 KB
testcase_23 AC 340 ms
10,584 KB
testcase_24 AC 180 ms
10,320 KB
testcase_25 AC 257 ms
10,320 KB
testcase_26 AC 121 ms
10,056 KB
testcase_27 AC 311 ms
10,584 KB
testcase_28 AC 38 ms
9,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
degree = [0] * N
for _ in range(N - 1):
    a, b = [int(i) - 1 for i in input().split()]
    degree[a] += 1
    degree[b] += 1

print(sum(d for d in degree if d == 1) - 2)
0