結果

問題 No.806 木を道に
ユーザー lloyzlloyz
提出日時 2022-07-12 22:22:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 9,164 KB
最終ジャッジ日時 2023-09-06 01:22:32
合計ジャッジ時間 6,004 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,800 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 16 ms
7,932 KB
testcase_03 AC 15 ms
7,936 KB
testcase_04 AC 15 ms
7,876 KB
testcase_05 AC 16 ms
7,816 KB
testcase_06 AC 15 ms
7,836 KB
testcase_07 AC 15 ms
7,864 KB
testcase_08 AC 15 ms
7,864 KB
testcase_09 AC 15 ms
7,804 KB
testcase_10 AC 80 ms
8,212 KB
testcase_11 AC 71 ms
8,404 KB
testcase_12 AC 256 ms
8,876 KB
testcase_13 AC 189 ms
8,832 KB
testcase_14 AC 253 ms
8,964 KB
testcase_15 AC 261 ms
9,024 KB
testcase_16 AC 104 ms
8,484 KB
testcase_17 AC 225 ms
8,928 KB
testcase_18 AC 39 ms
7,976 KB
testcase_19 AC 84 ms
8,400 KB
testcase_20 AC 234 ms
8,812 KB
testcase_21 AC 135 ms
8,612 KB
testcase_22 AC 308 ms
9,028 KB
testcase_23 AC 301 ms
9,164 KB
testcase_24 AC 165 ms
8,800 KB
testcase_25 AC 242 ms
8,828 KB
testcase_26 AC 102 ms
8,576 KB
testcase_27 AC 295 ms
9,108 KB
testcase_28 AC 24 ms
7,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
D = [0 for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    D[a - 1] += 1
    D[b - 1] += 1
ans = 0
for i in range(n):
    if D[i] == 1:
        ans += 1
print(ans - 2)
0