結果

問題 No.806 木を道に
ユーザー Konton7Konton7
提出日時 2019-05-24 10:21:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 232 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 11,824 KB
実行使用メモリ 10,964 KB
最終ジャッジ日時 2023-10-17 11:52:42
合計ジャッジ時間 5,367 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,084 KB
testcase_01 AC 30 ms
10,084 KB
testcase_02 AC 28 ms
10,084 KB
testcase_03 AC 30 ms
10,084 KB
testcase_04 AC 29 ms
10,084 KB
testcase_05 AC 29 ms
10,084 KB
testcase_06 AC 30 ms
10,084 KB
testcase_07 AC 29 ms
10,084 KB
testcase_08 AC 29 ms
10,084 KB
testcase_09 AC 29 ms
10,084 KB
testcase_10 AC 97 ms
10,192 KB
testcase_11 AC 91 ms
10,216 KB
testcase_12 AC 290 ms
10,844 KB
testcase_13 AC 216 ms
10,664 KB
testcase_14 AC 275 ms
10,812 KB
testcase_15 AC 292 ms
10,856 KB
testcase_16 AC 123 ms
10,432 KB
testcase_17 AC 253 ms
10,764 KB
testcase_18 AC 54 ms
10,160 KB
testcase_19 AC 100 ms
10,184 KB
testcase_20 AC 254 ms
10,764 KB
testcase_21 AC 158 ms
10,508 KB
testcase_22 AC 337 ms
10,964 KB
testcase_23 AC 335 ms
10,964 KB
testcase_24 AC 187 ms
10,596 KB
testcase_25 AC 268 ms
10,808 KB
testcase_26 AC 116 ms
10,416 KB
testcase_27 AC 313 ms
10,944 KB
testcase_28 AC 37 ms
10,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
connect_list = [0 for i in range(n)]
for i in range(n-1):
	a, b = [ int(v) for v in input().split() ]
	connect_list[a-1] += 1
	connect_list[b-1] += 1


s = 0
for i in connect_list:
	if i >= 2:
		s += i - 2
print(s)
0