結果

問題 No.806 木を道に
ユーザー O2MTO2MT
提出日時 2020-08-31 17:46:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 232 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 25,016 KB
最終ジャッジ日時 2023-08-10 08:42:48
合計ジャッジ時間 7,362 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 WA -
testcase_03 AC 15 ms
7,968 KB
testcase_04 WA -
testcase_05 AC 15 ms
8,008 KB
testcase_06 AC 16 ms
7,796 KB
testcase_07 AC 15 ms
7,864 KB
testcase_08 AC 15 ms
7,860 KB
testcase_09 AC 16 ms
7,956 KB
testcase_10 AC 89 ms
11,780 KB
testcase_11 AC 81 ms
11,340 KB
testcase_12 AC 321 ms
22,280 KB
testcase_13 AC 223 ms
18,284 KB
testcase_14 AC 296 ms
21,496 KB
testcase_15 WA -
testcase_16 AC 120 ms
13,316 KB
testcase_17 AC 272 ms
20,568 KB
testcase_18 AC 42 ms
9,292 KB
testcase_19 AC 92 ms
12,004 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 380 ms
24,592 KB
testcase_24 AC 174 ms
16,888 KB
testcase_25 AC 255 ms
21,344 KB
testcase_26 AC 106 ms
13,176 KB
testcase_27 AC 319 ms
25,016 KB
testcase_28 AC 23 ms
8,228 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):
  if len(tree[i]) > 2:
    ans += len(tree[i])-2

print(ans)
0