結果

問題 No.806 木を道に
ユーザー s_shoheis_shohei
提出日時 2020-08-02 15:11:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 91,268 KB
最終ジャッジ日時 2023-09-25 18:19:53
合計ジャッジ時間 5,981 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,236 KB
testcase_01 AC 77 ms
71,228 KB
testcase_02 AC 74 ms
71,416 KB
testcase_03 AC 75 ms
71,196 KB
testcase_04 AC 74 ms
71,324 KB
testcase_05 AC 75 ms
71,236 KB
testcase_06 AC 75 ms
71,060 KB
testcase_07 AC 73 ms
71,252 KB
testcase_08 AC 73 ms
71,128 KB
testcase_09 AC 72 ms
71,412 KB
testcase_10 AC 165 ms
79,636 KB
testcase_11 AC 131 ms
79,688 KB
testcase_12 AC 212 ms
86,496 KB
testcase_13 AC 181 ms
84,032 KB
testcase_14 AC 209 ms
86,148 KB
testcase_15 AC 214 ms
86,976 KB
testcase_16 AC 140 ms
80,488 KB
testcase_17 AC 201 ms
85,768 KB
testcase_18 AC 119 ms
78,276 KB
testcase_19 AC 134 ms
79,988 KB
testcase_20 AC 201 ms
85,568 KB
testcase_21 AC 159 ms
81,976 KB
testcase_22 AC 239 ms
88,068 KB
testcase_23 AC 239 ms
88,468 KB
testcase_24 AC 150 ms
82,064 KB
testcase_25 AC 170 ms
85,912 KB
testcase_26 AC 132 ms
81,252 KB
testcase_27 AC 191 ms
91,268 KB
testcase_28 AC 110 ms
77,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
link = [[] for _ in range(n)]
for i in range(n-1):
    a,b = list(map(int,input().split()))
    link[a-1].append(b-1)
    link[b-1].append(a-1)

ans=0
for i in range(n):
    ans+= max(len(link[i])-2,0)

print(ans)
0