結果

問題 No.806 木を道に
ユーザー titiatitia
提出日時 2019-03-22 21:32:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 362 ms / 2,000 ms
コード長 180 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 11,844 KB
実行使用メモリ 30,564 KB
最終ジャッジ日時 2023-10-19 06:32:25
合計ジャッジ時間 5,641 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,136 KB
testcase_01 AC 31 ms
10,136 KB
testcase_02 AC 31 ms
10,140 KB
testcase_03 AC 29 ms
10,140 KB
testcase_04 AC 29 ms
10,136 KB
testcase_05 AC 29 ms
10,144 KB
testcase_06 AC 30 ms
10,140 KB
testcase_07 AC 29 ms
10,136 KB
testcase_08 AC 30 ms
10,136 KB
testcase_09 AC 29 ms
10,136 KB
testcase_10 AC 99 ms
14,416 KB
testcase_11 AC 91 ms
13,888 KB
testcase_12 AC 321 ms
27,316 KB
testcase_13 AC 225 ms
22,696 KB
testcase_14 AC 290 ms
26,520 KB
testcase_15 AC 318 ms
27,576 KB
testcase_16 AC 127 ms
16,508 KB
testcase_17 AC 268 ms
25,364 KB
testcase_18 AC 55 ms
11,776 KB
testcase_19 AC 103 ms
14,680 KB
testcase_20 AC 270 ms
25,372 KB
testcase_21 AC 164 ms
18,760 KB
testcase_22 AC 362 ms
30,564 KB
testcase_23 AC 362 ms
30,564 KB
testcase_24 AC 194 ms
20,976 KB
testcase_25 AC 278 ms
26,528 KB
testcase_26 AC 122 ms
16,124 KB
testcase_27 AC 345 ms
30,040 KB
testcase_28 AC 38 ms
10,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
E=[list(map(int,input().split())) for i in range(N-1)]

W=[0]*N

for x,y in E:
    W[x-1]+=1
    W[y-1]+=1

ANS=0
for w in W:
    if w>2:
        ANS+=w-2
print(ANS)
0