結果

問題 No.806 木を道に
ユーザー YamadaYamada
提出日時 2019-04-12 17:00:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 389 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,512 KB
実行使用メモリ 24,820 KB
最終ジャッジ日時 2023-10-12 07:46:00
合計ジャッジ時間 7,697 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,852 KB
testcase_01 AC 15 ms
7,776 KB
testcase_02 AC 16 ms
7,952 KB
testcase_03 AC 15 ms
7,800 KB
testcase_04 AC 15 ms
7,804 KB
testcase_05 AC 16 ms
7,800 KB
testcase_06 AC 16 ms
7,776 KB
testcase_07 AC 15 ms
7,776 KB
testcase_08 AC 15 ms
7,772 KB
testcase_09 AC 15 ms
7,796 KB
testcase_10 AC 96 ms
11,664 KB
testcase_11 AC 84 ms
11,280 KB
testcase_12 AC 322 ms
22,344 KB
testcase_13 AC 232 ms
18,156 KB
testcase_14 AC 307 ms
21,356 KB
testcase_15 AC 332 ms
22,292 KB
testcase_16 AC 124 ms
13,216 KB
testcase_17 AC 290 ms
20,516 KB
testcase_18 AC 44 ms
9,344 KB
testcase_19 AC 97 ms
11,820 KB
testcase_20 AC 281 ms
20,428 KB
testcase_21 AC 163 ms
14,944 KB
testcase_22 AC 388 ms
24,688 KB
testcase_23 AC 389 ms
24,688 KB
testcase_24 AC 182 ms
16,996 KB
testcase_25 AC 272 ms
21,412 KB
testcase_26 AC 113 ms
13,100 KB
testcase_27 AC 335 ms
24,820 KB
testcase_28 AC 23 ms
8,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
l = [[]for _ in range(N)]
for _ in range(N-1):
    a,b = [int(i)-1 for i in input().split()]
    l[a].append(b)
    l[b].append(a)
ans = 0
for lis in l:
    if len(lis) > 2:
        ans += len(lis)-2
print(ans)
0