結果

問題 No.806 木を道に
ユーザー hogeandfugahogeandfuga
提出日時 2019-03-22 22:51:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 209 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2023-10-19 10:00:24
合計ジャッジ時間 3,841 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,440 KB
testcase_01 AC 40 ms
53,440 KB
testcase_02 AC 41 ms
53,440 KB
testcase_03 AC 40 ms
53,440 KB
testcase_04 AC 40 ms
53,440 KB
testcase_05 AC 44 ms
53,440 KB
testcase_06 AC 41 ms
53,440 KB
testcase_07 AC 41 ms
53,440 KB
testcase_08 AC 40 ms
53,440 KB
testcase_09 AC 39 ms
53,440 KB
testcase_10 AC 89 ms
75,956 KB
testcase_11 AC 88 ms
75,932 KB
testcase_12 AC 120 ms
76,448 KB
testcase_13 AC 106 ms
76,264 KB
testcase_14 AC 116 ms
76,408 KB
testcase_15 AC 122 ms
76,468 KB
testcase_16 AC 88 ms
76,016 KB
testcase_17 AC 114 ms
76,364 KB
testcase_18 AC 76 ms
72,804 KB
testcase_19 AC 89 ms
75,960 KB
testcase_20 AC 112 ms
76,364 KB
testcase_21 AC 98 ms
76,100 KB
testcase_22 AC 128 ms
76,564 KB
testcase_23 AC 127 ms
76,564 KB
testcase_24 AC 96 ms
76,192 KB
testcase_25 AC 112 ms
76,408 KB
testcase_26 AC 89 ms
76,016 KB
testcase_27 AC 120 ms
77,312 KB
testcase_28 AC 70 ms
68,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
deg = [0]*(n+1)
for i in range(n-1):
    a, b = map(int, input().split())
    deg[a] += 1
    deg[b] += 1
ans = 0
for i in range(1, n+1):
    if deg[i] > 2:
        ans += deg[i]-2
print(ans)
0