結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,296 KB
testcase_01 AC 39 ms
53,296 KB
testcase_02 AC 39 ms
53,296 KB
testcase_03 AC 38 ms
53,296 KB
testcase_04 AC 39 ms
53,296 KB
testcase_05 AC 38 ms
53,296 KB
testcase_06 AC 39 ms
53,296 KB
testcase_07 AC 38 ms
53,296 KB
testcase_08 AC 38 ms
53,296 KB
testcase_09 AC 38 ms
53,296 KB
testcase_10 AC 82 ms
75,852 KB
testcase_11 AC 80 ms
75,820 KB
testcase_12 AC 115 ms
76,336 KB
testcase_13 AC 101 ms
76,152 KB
testcase_14 AC 114 ms
76,300 KB
testcase_15 AC 119 ms
76,360 KB
testcase_16 AC 85 ms
75,912 KB
testcase_17 AC 109 ms
76,256 KB
testcase_18 AC 69 ms
72,696 KB
testcase_19 AC 81 ms
75,852 KB
testcase_20 AC 108 ms
76,252 KB
testcase_21 AC 90 ms
75,992 KB
testcase_22 AC 124 ms
76,456 KB
testcase_23 AC 123 ms
76,456 KB
testcase_24 AC 93 ms
76,088 KB
testcase_25 AC 104 ms
76,300 KB
testcase_26 AC 83 ms
75,904 KB
testcase_27 AC 114 ms
77,204 KB
testcase_28 AC 65 ms
68,588 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