結果

問題 No.806 木を道に
ユーザー syunsukesyunsuke
提出日時 2019-04-30 23:13:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 304 ms / 2,000 ms
コード長 200 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 9,056 KB
最終ジャッジ日時 2023-08-30 04:10:30
合計ジャッジ時間 6,783 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,812 KB
testcase_01 AC 16 ms
7,880 KB
testcase_02 AC 16 ms
7,832 KB
testcase_03 AC 16 ms
7,772 KB
testcase_04 AC 16 ms
7,780 KB
testcase_05 AC 16 ms
7,816 KB
testcase_06 AC 15 ms
7,744 KB
testcase_07 AC 16 ms
7,744 KB
testcase_08 AC 16 ms
7,872 KB
testcase_09 AC 16 ms
7,816 KB
testcase_10 AC 78 ms
8,240 KB
testcase_11 AC 72 ms
8,152 KB
testcase_12 AC 261 ms
8,960 KB
testcase_13 AC 193 ms
8,700 KB
testcase_14 AC 248 ms
8,816 KB
testcase_15 AC 264 ms
8,904 KB
testcase_16 AC 105 ms
8,412 KB
testcase_17 AC 234 ms
8,872 KB
testcase_18 AC 39 ms
7,812 KB
testcase_19 AC 83 ms
8,216 KB
testcase_20 AC 234 ms
8,804 KB
testcase_21 AC 135 ms
8,528 KB
testcase_22 AC 304 ms
9,056 KB
testcase_23 AC 299 ms
9,012 KB
testcase_24 AC 162 ms
8,700 KB
testcase_25 AC 238 ms
8,812 KB
testcase_26 AC 99 ms
8,440 KB
testcase_27 AC 285 ms
8,992 KB
testcase_28 AC 23 ms
7,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())

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