結果

問題 No.806 木を道に
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-29 15:57:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 330 ms / 2,000 ms
コード長 170 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 8,792 KB
最終ジャッジ日時 2023-08-30 15:22:59
合計ジャッジ時間 7,332 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,752 KB
testcase_01 AC 16 ms
7,888 KB
testcase_02 AC 16 ms
7,796 KB
testcase_03 AC 15 ms
7,820 KB
testcase_04 AC 15 ms
7,788 KB
testcase_05 AC 15 ms
7,796 KB
testcase_06 AC 15 ms
7,752 KB
testcase_07 AC 15 ms
7,856 KB
testcase_08 AC 15 ms
7,824 KB
testcase_09 AC 16 ms
7,852 KB
testcase_10 AC 84 ms
8,192 KB
testcase_11 AC 77 ms
8,060 KB
testcase_12 AC 280 ms
8,792 KB
testcase_13 AC 207 ms
8,416 KB
testcase_14 AC 265 ms
8,620 KB
testcase_15 AC 286 ms
8,724 KB
testcase_16 AC 112 ms
8,188 KB
testcase_17 AC 250 ms
8,520 KB
testcase_18 AC 41 ms
8,124 KB
testcase_19 AC 89 ms
8,216 KB
testcase_20 AC 242 ms
8,504 KB
testcase_21 AC 146 ms
8,320 KB
testcase_22 AC 330 ms
8,708 KB
testcase_23 AC 325 ms
8,772 KB
testcase_24 AC 173 ms
8,520 KB
testcase_25 AC 255 ms
8,456 KB
testcase_26 AC 106 ms
8,264 KB
testcase_27 AC 310 ms
8,720 KB
testcase_28 AC 24 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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