結果

問題 No.806 木を道に
ユーザー pasoconhoshiipasoconhoshii
提出日時 2019-03-23 09:04:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 234 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 11,704 KB
実行使用メモリ 30,452 KB
最終ジャッジ日時 2023-10-21 20:09:58
合計ジャッジ時間 7,940 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,036 KB
testcase_01 AC 28 ms
10,036 KB
testcase_02 AC 27 ms
10,040 KB
testcase_03 AC 25 ms
10,040 KB
testcase_04 AC 26 ms
10,036 KB
testcase_05 AC 27 ms
10,044 KB
testcase_06 AC 26 ms
10,040 KB
testcase_07 AC 25 ms
10,036 KB
testcase_08 AC 25 ms
10,036 KB
testcase_09 AC 27 ms
10,036 KB
testcase_10 AC 93 ms
14,392 KB
testcase_11 AC 86 ms
13,864 KB
testcase_12 AC 289 ms
27,204 KB
testcase_13 AC 214 ms
22,584 KB
testcase_14 AC 286 ms
26,408 KB
testcase_15 AC 301 ms
27,464 KB
testcase_16 AC 125 ms
16,396 KB
testcase_17 AC 251 ms
25,256 KB
testcase_18 AC 54 ms
11,664 KB
testcase_19 AC 97 ms
14,656 KB
testcase_20 AC 256 ms
25,260 KB
testcase_21 AC 158 ms
18,652 KB
testcase_22 AC 337 ms
30,452 KB
testcase_23 AC 342 ms
30,452 KB
testcase_24 AC 186 ms
20,864 KB
testcase_25 AC 270 ms
26,416 KB
testcase_26 AC 118 ms
16,016 KB
testcase_27 AC 354 ms
29,928 KB
testcase_28 AC 37 ms
10,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
AB = [ list(map(int, input().split())) for _i in range(N-1)]

v = [0] * N

for a,b in AB:
    a,b = a-1, b-1
    v[a] += 1
    v[b] += 1

ans = 0

for i in range(N):
    if v[i] > 2:
        ans += v[i] - 2
print(ans)
0