結果

問題 No.806 木を道に
ユーザー kamojirokamojiro
提出日時 2019-03-22 22:26:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,912 KB
実行使用メモリ 26,876 KB
最終ジャッジ日時 2023-10-19 09:43:44
合計ジャッジ時間 6,376 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,044 KB
testcase_01 AC 29 ms
10,044 KB
testcase_02 AC 30 ms
10,044 KB
testcase_03 AC 30 ms
10,044 KB
testcase_04 AC 30 ms
10,044 KB
testcase_05 AC 31 ms
10,048 KB
testcase_06 AC 30 ms
10,044 KB
testcase_07 AC 29 ms
10,044 KB
testcase_08 AC 29 ms
10,044 KB
testcase_09 AC 31 ms
10,044 KB
testcase_10 AC 113 ms
13,520 KB
testcase_11 AC 109 ms
13,256 KB
testcase_12 AC 378 ms
24,124 KB
testcase_13 AC 279 ms
20,120 KB
testcase_14 AC 360 ms
23,312 KB
testcase_15 AC 391 ms
24,216 KB
testcase_16 AC 149 ms
15,216 KB
testcase_17 AC 336 ms
22,396 KB
testcase_18 AC 60 ms
11,368 KB
testcase_19 AC 118 ms
13,784 KB
testcase_20 AC 332 ms
22,400 KB
testcase_21 AC 195 ms
16,888 KB
testcase_22 AC 446 ms
26,520 KB
testcase_23 AC 444 ms
26,520 KB
testcase_24 AC 222 ms
18,804 KB
testcase_25 AC 314 ms
23,292 KB
testcase_26 AC 132 ms
15,108 KB
testcase_27 AC 378 ms
26,876 KB
testcase_28 AC 39 ms
10,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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