結果

問題 No.806 木を道に
ユーザー 12354865271235486527
提出日時 2019-12-08 22:28:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 166 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 8,876 KB
最終ジャッジ日時 2023-08-30 08:39:01
合計ジャッジ時間 6,895 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,764 KB
testcase_01 AC 16 ms
7,884 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 16 ms
7,832 KB
testcase_04 AC 16 ms
7,764 KB
testcase_05 AC 17 ms
7,820 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,808 KB
testcase_08 AC 16 ms
7,860 KB
testcase_09 AC 15 ms
7,804 KB
testcase_10 AC 84 ms
8,344 KB
testcase_11 AC 76 ms
8,316 KB
testcase_12 AC 277 ms
8,620 KB
testcase_13 AC 204 ms
8,432 KB
testcase_14 AC 262 ms
8,572 KB
testcase_15 AC 278 ms
8,792 KB
testcase_16 AC 112 ms
8,168 KB
testcase_17 AC 242 ms
8,468 KB
testcase_18 AC 40 ms
7,820 KB
testcase_19 AC 86 ms
8,200 KB
testcase_20 AC 243 ms
8,572 KB
testcase_21 AC 145 ms
8,208 KB
testcase_22 AC 319 ms
8,700 KB
testcase_23 AC 318 ms
8,852 KB
testcase_24 AC 169 ms
8,552 KB
testcase_25 AC 254 ms
8,596 KB
testcase_26 AC 103 ms
8,304 KB
testcase_27 AC 306 ms
8,876 KB
testcase_28 AC 24 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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