結果

問題 No.806 木を道に
ユーザー 💕💖💞💕💖💞
提出日時 2019-05-11 18:33:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 537 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,572 KB
実行使用メモリ 50,772 KB
最終ジャッジ日時 2023-09-14 18:13:44
合計ジャッジ時間 7,266 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,732 KB
testcase_01 AC 15 ms
7,744 KB
testcase_02 AC 16 ms
7,880 KB
testcase_03 AC 16 ms
7,748 KB
testcase_04 AC 15 ms
7,792 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 16 ms
7,828 KB
testcase_07 AC 15 ms
7,820 KB
testcase_08 AC 16 ms
7,752 KB
testcase_09 AC 16 ms
7,748 KB
testcase_10 AC 117 ms
16,680 KB
testcase_11 AC 104 ms
15,000 KB
testcase_12 AC 440 ms
38,360 KB
testcase_13 AC 323 ms
30,560 KB
testcase_14 AC 413 ms
36,932 KB
testcase_15 AC 435 ms
38,748 KB
testcase_16 AC 156 ms
19,544 KB
testcase_17 AC 381 ms
34,796 KB
testcase_18 AC 51 ms
11,080 KB
testcase_19 AC 123 ms
16,856 KB
testcase_20 AC 382 ms
34,948 KB
testcase_21 AC 211 ms
22,972 KB
testcase_22 AC 537 ms
45,800 KB
testcase_23 AC 534 ms
45,916 KB
testcase_24 AC 230 ms
27,520 KB
testcase_25 AC 337 ms
35,812 KB
testcase_26 AC 132 ms
21,352 KB
testcase_27 AC 428 ms
50,772 KB
testcase_28 AC 26 ms
9,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

buff = {}
for n in range(1, N+1):
    buff[n] = set()

for n in range(N-1):
    a, b = map(int, input().split())
    buff[a].add(b)
    buff[b].add(a)

change_num = 0
for key, vals in buff.items():
    if len(vals) >= 2:
        change_num += len(vals) - 2

#print(buff)
print(change_num)
0