結果

問題 No.806 木を道に
ユーザー nohakai3nohakai3
提出日時 2022-11-05 11:53:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 1,198 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 89,900 KB
最終ジャッジ日時 2023-09-26 11:40:14
合計ジャッジ時間 8,180 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,064 KB
testcase_01 AC 73 ms
71,216 KB
testcase_02 AC 71 ms
71,080 KB
testcase_03 AC 73 ms
71,176 KB
testcase_04 AC 73 ms
71,452 KB
testcase_05 AC 74 ms
71,352 KB
testcase_06 AC 74 ms
71,348 KB
testcase_07 AC 73 ms
71,352 KB
testcase_08 AC 74 ms
71,284 KB
testcase_09 AC 74 ms
71,184 KB
testcase_10 AC 125 ms
78,776 KB
testcase_11 AC 122 ms
78,816 KB
testcase_12 AC 199 ms
85,940 KB
testcase_13 AC 167 ms
83,140 KB
testcase_14 AC 203 ms
85,828 KB
testcase_15 AC 209 ms
86,204 KB
testcase_16 AC 146 ms
79,152 KB
testcase_17 AC 198 ms
85,532 KB
testcase_18 AC 123 ms
78,160 KB
testcase_19 AC 134 ms
78,848 KB
testcase_20 AC 198 ms
85,412 KB
testcase_21 AC 158 ms
81,928 KB
testcase_22 AC 231 ms
88,592 KB
testcase_23 AC 229 ms
88,420 KB
testcase_24 AC 132 ms
81,900 KB
testcase_25 AC 149 ms
85,576 KB
testcase_26 AC 119 ms
80,224 KB
testcase_27 AC 167 ms
89,900 KB
testcase_28 AC 97 ms
76,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
G=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

ans=0
for i in range(n):
    if len(G[i])>=3:
        ans+=len(G[i])-2
    
print(ans)
0