結果

問題 No.806 木を道に
ユーザー 👑 KazunKazun
提出日時 2021-01-05 00:18:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 190 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 82,532 KB
実行使用メモリ 77,328 KB
最終ジャッジ日時 2024-04-23 09:00:41
合計ジャッジ時間 2,909 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,700 KB
testcase_01 AC 33 ms
52,900 KB
testcase_02 AC 34 ms
52,536 KB
testcase_03 AC 35 ms
52,196 KB
testcase_04 AC 36 ms
52,408 KB
testcase_05 AC 35 ms
53,724 KB
testcase_06 AC 33 ms
52,268 KB
testcase_07 AC 33 ms
52,240 KB
testcase_08 AC 33 ms
52,508 KB
testcase_09 AC 32 ms
53,356 KB
testcase_10 AC 48 ms
72,888 KB
testcase_11 AC 47 ms
69,556 KB
testcase_12 AC 63 ms
76,876 KB
testcase_13 AC 60 ms
77,240 KB
testcase_14 AC 63 ms
77,000 KB
testcase_15 AC 70 ms
77,328 KB
testcase_16 AC 51 ms
74,344 KB
testcase_17 AC 64 ms
76,520 KB
testcase_18 AC 46 ms
66,232 KB
testcase_19 AC 52 ms
71,404 KB
testcase_20 AC 69 ms
76,516 KB
testcase_21 AC 58 ms
76,212 KB
testcase_22 AC 71 ms
77,252 KB
testcase_23 AC 72 ms
77,184 KB
testcase_24 AC 58 ms
76,980 KB
testcase_25 AC 63 ms
76,844 KB
testcase_26 AC 51 ms
74,652 KB
testcase_27 AC 68 ms
77,304 KB
testcase_28 AC 44 ms
61,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline

N=int(input())
D=[0]*(N+1)

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

S=0
for d in D[1:]:
    S+=max(0,d-2)
print(S)
0