結果

問題 No.806 木を道に
ユーザー O2MTO2MT
提出日時 2020-08-31 17:51:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 380 ms / 2,000 ms
コード長 234 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 25,032 KB
最終ジャッジ日時 2023-08-10 09:00:22
合計ジャッジ時間 5,894 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,836 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 16 ms
7,876 KB
testcase_03 AC 15 ms
7,924 KB
testcase_04 AC 15 ms
7,844 KB
testcase_05 AC 15 ms
7,832 KB
testcase_06 AC 15 ms
7,876 KB
testcase_07 AC 15 ms
7,848 KB
testcase_08 AC 15 ms
7,924 KB
testcase_09 AC 16 ms
7,980 KB
testcase_10 AC 84 ms
11,740 KB
testcase_11 AC 78 ms
11,300 KB
testcase_12 AC 301 ms
22,320 KB
testcase_13 AC 222 ms
18,152 KB
testcase_14 AC 281 ms
21,452 KB
testcase_15 AC 316 ms
22,256 KB
testcase_16 AC 115 ms
13,168 KB
testcase_17 AC 268 ms
20,472 KB
testcase_18 AC 40 ms
9,568 KB
testcase_19 AC 89 ms
11,852 KB
testcase_20 AC 260 ms
20,508 KB
testcase_21 AC 149 ms
15,120 KB
testcase_22 AC 380 ms
24,784 KB
testcase_23 AC 372 ms
24,628 KB
testcase_24 AC 174 ms
16,856 KB
testcase_25 AC 249 ms
21,368 KB
testcase_26 AC 104 ms
13,196 KB
testcase_27 AC 313 ms
25,032 KB
testcase_28 AC 22 ms
8,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
tree = [[] for _ in range(N+1)] 
for _ in range(N-1):
  a,b = map(int,input().split())
  tree[a].append(b)
  tree[b].append(a)
ans = 0

for i in range(N+1):
  if len(tree[i]) > 2:
    ans += len(tree[i])-2

print(ans)
0