結果

問題 No.806 木を道に
ユーザー もりをもりを
提出日時 2019-03-22 21:35:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 326 ms / 2,000 ms
コード長 201 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 11,784 KB
実行使用メモリ 10,700 KB
最終ジャッジ日時 2023-10-19 06:34:34
合計ジャッジ時間 5,387 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
10,700 KB
testcase_01 AC 37 ms
10,700 KB
testcase_02 AC 39 ms
10,700 KB
testcase_03 AC 39 ms
10,700 KB
testcase_04 AC 37 ms
10,700 KB
testcase_05 AC 37 ms
10,700 KB
testcase_06 AC 37 ms
10,700 KB
testcase_07 AC 38 ms
10,700 KB
testcase_08 AC 38 ms
10,700 KB
testcase_09 AC 38 ms
10,700 KB
testcase_10 AC 98 ms
10,700 KB
testcase_11 AC 91 ms
10,700 KB
testcase_12 AC 280 ms
10,700 KB
testcase_13 AC 214 ms
10,700 KB
testcase_14 AC 261 ms
10,700 KB
testcase_15 AC 284 ms
10,700 KB
testcase_16 AC 125 ms
10,700 KB
testcase_17 AC 242 ms
10,700 KB
testcase_18 AC 60 ms
10,700 KB
testcase_19 AC 102 ms
10,700 KB
testcase_20 AC 245 ms
10,700 KB
testcase_21 AC 154 ms
10,700 KB
testcase_22 AC 323 ms
10,700 KB
testcase_23 AC 326 ms
10,700 KB
testcase_24 AC 185 ms
10,700 KB
testcase_25 AC 257 ms
10,700 KB
testcase_26 AC 120 ms
10,700 KB
testcase_27 AC 303 ms
10,700 KB
testcase_28 AC 45 ms
10,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
arr = [0] * (100100)
for i in range(n - 1):
    a,b = map(int,input().split())
    arr[a] += 1
    arr[b] += 1
mx = 0
for i in arr:
    if i > 2:
        mx += i - 2
print(max(0, mx))
0