結果

問題 No.806 木を道に
ユーザー ttrttr
提出日時 2020-02-08 21:20:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 463 ms / 2,000 ms
コード長 206 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 27,008 KB
最終ジャッジ日時 2024-04-08 11:28:42
合計ジャッジ時間 6,597 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,984 KB
testcase_01 AC 29 ms
9,984 KB
testcase_02 AC 30 ms
9,984 KB
testcase_03 AC 29 ms
9,984 KB
testcase_04 AC 29 ms
9,984 KB
testcase_05 AC 29 ms
9,984 KB
testcase_06 AC 29 ms
9,984 KB
testcase_07 AC 29 ms
9,984 KB
testcase_08 AC 28 ms
9,984 KB
testcase_09 AC 29 ms
9,984 KB
testcase_10 AC 115 ms
13,696 KB
testcase_11 AC 107 ms
13,312 KB
testcase_12 AC 384 ms
24,192 KB
testcase_13 AC 278 ms
20,224 KB
testcase_14 AC 368 ms
23,424 KB
testcase_15 AC 396 ms
24,320 KB
testcase_16 AC 153 ms
15,232 KB
testcase_17 AC 345 ms
22,400 KB
testcase_18 AC 61 ms
11,392 KB
testcase_19 AC 121 ms
13,824 KB
testcase_20 AC 343 ms
22,400 KB
testcase_21 AC 198 ms
17,024 KB
testcase_22 AC 460 ms
26,624 KB
testcase_23 AC 463 ms
26,624 KB
testcase_24 AC 216 ms
18,816 KB
testcase_25 AC 310 ms
23,296 KB
testcase_26 AC 140 ms
15,232 KB
testcase_27 AC 392 ms
27,008 KB
testcase_28 AC 39 ms
10,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
E = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

ans = 0
for e in E:
    ans += max(0, len(e)-2)
print(ans)
0