結果

問題 No.806 木を道に
ユーザー kyo1kyo1
提出日時 2020-10-17 03:34:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 349 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 9,052 KB
最終ジャッジ日時 2023-09-28 07:19:14
合計ジャッジ時間 8,302 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,900 KB
testcase_01 AC 16 ms
7,988 KB
testcase_02 AC 17 ms
7,780 KB
testcase_03 AC 16 ms
7,852 KB
testcase_04 AC 15 ms
7,924 KB
testcase_05 AC 16 ms
7,920 KB
testcase_06 AC 15 ms
7,904 KB
testcase_07 AC 15 ms
7,816 KB
testcase_08 AC 15 ms
7,784 KB
testcase_09 AC 15 ms
7,908 KB
testcase_10 AC 93 ms
8,224 KB
testcase_11 AC 79 ms
8,240 KB
testcase_12 AC 293 ms
8,860 KB
testcase_13 AC 218 ms
8,808 KB
testcase_14 AC 277 ms
8,828 KB
testcase_15 AC 299 ms
8,872 KB
testcase_16 AC 116 ms
8,604 KB
testcase_17 AC 258 ms
8,952 KB
testcase_18 AC 42 ms
7,824 KB
testcase_19 AC 91 ms
8,188 KB
testcase_20 AC 256 ms
8,944 KB
testcase_21 AC 152 ms
8,652 KB
testcase_22 AC 349 ms
8,984 KB
testcase_23 AC 342 ms
9,052 KB
testcase_24 AC 183 ms
8,792 KB
testcase_25 AC 272 ms
8,852 KB
testcase_26 AC 112 ms
8,600 KB
testcase_27 AC 325 ms
9,028 KB
testcase_28 AC 24 ms
7,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

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

res = 0
for d in D:
    res += max(d - 2, 0)

print(res)
0