結果

問題 No.806 木を道に
ユーザー oshiborioshibori
提出日時 2019-03-22 21:50:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 183 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,532 KB
実行使用メモリ 77,160 KB
最終ジャッジ日時 2023-10-19 07:49:15
合計ジャッジ時間 3,829 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,308 KB
testcase_01 AC 41 ms
53,308 KB
testcase_02 AC 40 ms
53,308 KB
testcase_03 AC 41 ms
53,308 KB
testcase_04 AC 40 ms
53,308 KB
testcase_05 AC 40 ms
53,308 KB
testcase_06 AC 41 ms
53,308 KB
testcase_07 AC 39 ms
53,308 KB
testcase_08 AC 40 ms
53,308 KB
testcase_09 AC 40 ms
53,308 KB
testcase_10 AC 84 ms
75,800 KB
testcase_11 AC 84 ms
75,776 KB
testcase_12 AC 117 ms
76,292 KB
testcase_13 AC 103 ms
76,104 KB
testcase_14 AC 114 ms
76,260 KB
testcase_15 AC 118 ms
76,312 KB
testcase_16 AC 87 ms
75,864 KB
testcase_17 AC 112 ms
76,212 KB
testcase_18 AC 73 ms
72,652 KB
testcase_19 AC 83 ms
75,804 KB
testcase_20 AC 111 ms
76,212 KB
testcase_21 AC 91 ms
75,944 KB
testcase_22 AC 124 ms
76,412 KB
testcase_23 AC 123 ms
76,412 KB
testcase_24 AC 93 ms
76,040 KB
testcase_25 AC 105 ms
76,248 KB
testcase_26 AC 84 ms
75,864 KB
testcase_27 AC 116 ms
77,160 KB
testcase_28 AC 68 ms
68,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())

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