結果

問題 No.806 木を道に
ユーザー tpynerivertpyneriver
提出日時 2019-03-22 21:43:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 189 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 81,532 KB
実行使用メモリ 82,196 KB
最終ジャッジ日時 2023-10-19 06:52:24
合計ジャッジ時間 3,087 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,268 KB
testcase_01 AC 39 ms
53,268 KB
testcase_02 AC 39 ms
53,268 KB
testcase_03 AC 39 ms
53,268 KB
testcase_04 AC 39 ms
53,268 KB
testcase_05 AC 40 ms
53,268 KB
testcase_06 AC 40 ms
53,268 KB
testcase_07 AC 38 ms
53,268 KB
testcase_08 AC 38 ms
53,268 KB
testcase_09 AC 39 ms
53,268 KB
testcase_10 AC 57 ms
72,536 KB
testcase_11 AC 56 ms
70,480 KB
testcase_12 AC 78 ms
77,068 KB
testcase_13 AC 71 ms
76,352 KB
testcase_14 AC 77 ms
77,060 KB
testcase_15 AC 79 ms
77,028 KB
testcase_16 AC 63 ms
75,560 KB
testcase_17 AC 76 ms
76,684 KB
testcase_18 AC 52 ms
66,220 KB
testcase_19 AC 57 ms
72,548 KB
testcase_20 AC 77 ms
76,680 KB
testcase_21 AC 65 ms
75,548 KB
testcase_22 AC 86 ms
77,740 KB
testcase_23 AC 83 ms
77,736 KB
testcase_24 AC 66 ms
75,624 KB
testcase_25 AC 71 ms
75,836 KB
testcase_26 AC 62 ms
76,660 KB
testcase_27 AC 81 ms
82,196 KB
testcase_28 AC 49 ms
62,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
N = int(input())
dim = [0]*(N+1)
for _ in range(N-1):
    a, b = map(int, sys.stdin.readline().split())
    dim[a] += 1
    dim[b] += 1
print(sum([i for i in dim if i == 1]) - 2)
0