結果

問題 No.806 木を道に
ユーザー sinsincoscossinsincoscos
提出日時 2019-02-24 15:34:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 179 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 78,964 KB
最終ジャッジ日時 2023-09-21 09:28:46
合計ジャッジ時間 4,809 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,256 KB
testcase_01 AC 72 ms
71,332 KB
testcase_02 AC 71 ms
71,320 KB
testcase_03 AC 70 ms
71,268 KB
testcase_04 AC 70 ms
71,080 KB
testcase_05 AC 70 ms
71,512 KB
testcase_06 AC 70 ms
71,384 KB
testcase_07 AC 70 ms
71,168 KB
testcase_08 AC 70 ms
71,312 KB
testcase_09 AC 70 ms
71,252 KB
testcase_10 AC 105 ms
77,568 KB
testcase_11 AC 103 ms
77,360 KB
testcase_12 AC 136 ms
77,988 KB
testcase_13 AC 121 ms
77,708 KB
testcase_14 AC 137 ms
78,032 KB
testcase_15 AC 142 ms
77,964 KB
testcase_16 AC 115 ms
77,464 KB
testcase_17 AC 134 ms
77,904 KB
testcase_18 AC 104 ms
77,644 KB
testcase_19 AC 106 ms
77,456 KB
testcase_20 AC 132 ms
78,036 KB
testcase_21 AC 115 ms
77,636 KB
testcase_22 AC 145 ms
78,232 KB
testcase_23 AC 144 ms
78,196 KB
testcase_24 AC 114 ms
77,476 KB
testcase_25 AC 127 ms
77,784 KB
testcase_26 AC 108 ms
77,764 KB
testcase_27 AC 138 ms
78,964 KB
testcase_28 AC 94 ms
76,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

cnt = [0]*(N+1)
for i in range(N-1):
	a,b = map(int,input().split())
	cnt[a] += 1
	cnt[b] += 1

ans = 0
for i in range(N):
	ans += max(cnt[i+1]-2,0)

print(ans)
0