結果

問題 No.806 木を道に
ユーザー 👑 KazunKazun
提出日時 2021-01-05 00:17:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 153 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 77,848 KB
最終ジャッジ日時 2024-04-23 08:59:35
合計ジャッジ時間 3,468 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,116 KB
testcase_01 AC 32 ms
52,816 KB
testcase_02 AC 33 ms
53,352 KB
testcase_03 AC 34 ms
53,184 KB
testcase_04 AC 33 ms
52,888 KB
testcase_05 AC 34 ms
53,060 KB
testcase_06 AC 34 ms
52,208 KB
testcase_07 AC 32 ms
52,488 KB
testcase_08 AC 33 ms
53,580 KB
testcase_09 AC 32 ms
52,000 KB
testcase_10 AC 71 ms
76,244 KB
testcase_11 AC 68 ms
76,288 KB
testcase_12 AC 93 ms
77,468 KB
testcase_13 AC 85 ms
77,052 KB
testcase_14 AC 93 ms
77,848 KB
testcase_15 AC 100 ms
77,424 KB
testcase_16 AC 73 ms
76,732 KB
testcase_17 AC 91 ms
77,000 KB
testcase_18 AC 61 ms
73,464 KB
testcase_19 AC 72 ms
76,584 KB
testcase_20 AC 93 ms
77,172 KB
testcase_21 AC 79 ms
76,820 KB
testcase_22 AC 100 ms
77,732 KB
testcase_23 AC 103 ms
77,336 KB
testcase_24 AC 78 ms
77,132 KB
testcase_25 AC 93 ms
77,368 KB
testcase_26 AC 71 ms
76,728 KB
testcase_27 AC 97 ms
77,520 KB
testcase_28 AC 56 ms
70,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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