結果

問題 No.806 木を道に
ユーザー 👑 rin204rin204
提出日時 2022-01-19 00:49:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 174 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 78,380 KB
最終ジャッジ日時 2023-08-15 07:47:24
合計ジャッジ時間 6,404 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,116 KB
testcase_01 AC 65 ms
71,320 KB
testcase_02 AC 65 ms
71,136 KB
testcase_03 AC 66 ms
71,124 KB
testcase_04 AC 63 ms
71,364 KB
testcase_05 AC 65 ms
71,248 KB
testcase_06 AC 63 ms
71,264 KB
testcase_07 AC 64 ms
71,196 KB
testcase_08 AC 62 ms
71,276 KB
testcase_09 AC 63 ms
71,288 KB
testcase_10 AC 100 ms
77,236 KB
testcase_11 AC 98 ms
77,380 KB
testcase_12 AC 126 ms
77,572 KB
testcase_13 AC 115 ms
77,328 KB
testcase_14 AC 127 ms
77,716 KB
testcase_15 AC 130 ms
77,728 KB
testcase_16 AC 108 ms
76,960 KB
testcase_17 AC 125 ms
77,908 KB
testcase_18 AC 95 ms
77,052 KB
testcase_19 AC 101 ms
77,040 KB
testcase_20 AC 125 ms
77,808 KB
testcase_21 AC 108 ms
77,520 KB
testcase_22 AC 133 ms
77,740 KB
testcase_23 AC 135 ms
77,732 KB
testcase_24 AC 108 ms
77,460 KB
testcase_25 AC 120 ms
78,000 KB
testcase_26 AC 98 ms
77,428 KB
testcase_27 AC 129 ms
78,380 KB
testcase_28 AC 86 ms
76,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
cnt = [0] * n
for _ in range(n - 1):
    a, b = map(int, input().split())
    cnt[a - 1] += 1
    cnt[b - 1] += 1
    
print(sum(max(c - 2, 0) for c in cnt))
0