結果

問題 No.806 木を道に
ユーザー hogeandfugahogeandfuga
提出日時 2019-03-22 22:53:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 209 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 77,296 KB
最終ジャッジ日時 2023-10-19 10:07:40
合計ジャッジ時間 3,607 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,432 KB
testcase_01 AC 38 ms
53,432 KB
testcase_02 AC 39 ms
53,432 KB
testcase_03 AC 39 ms
53,432 KB
testcase_04 AC 39 ms
53,432 KB
testcase_05 AC 40 ms
53,432 KB
testcase_06 AC 40 ms
53,432 KB
testcase_07 AC 39 ms
53,432 KB
testcase_08 AC 39 ms
53,432 KB
testcase_09 AC 39 ms
53,432 KB
testcase_10 AC 80 ms
75,944 KB
testcase_11 AC 78 ms
75,912 KB
testcase_12 AC 116 ms
76,428 KB
testcase_13 AC 102 ms
76,248 KB
testcase_14 AC 111 ms
76,392 KB
testcase_15 AC 115 ms
76,452 KB
testcase_16 AC 84 ms
76,000 KB
testcase_17 AC 107 ms
76,348 KB
testcase_18 AC 69 ms
72,788 KB
testcase_19 AC 80 ms
75,940 KB
testcase_20 AC 106 ms
76,348 KB
testcase_21 AC 91 ms
76,088 KB
testcase_22 AC 124 ms
76,544 KB
testcase_23 AC 122 ms
76,548 KB
testcase_24 AC 92 ms
76,180 KB
testcase_25 AC 103 ms
76,388 KB
testcase_26 AC 84 ms
76,000 KB
testcase_27 AC 116 ms
77,296 KB
testcase_28 AC 65 ms
68,680 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