結果

問題 No.806 木を道に
ユーザー wgrapewgrape
提出日時 2023-11-01 17:51:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 232 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 88,504 KB
最終ジャッジ日時 2023-11-01 17:52:02
合計ジャッジ時間 5,982 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,592 KB
testcase_01 AC 34 ms
53,592 KB
testcase_02 AC 34 ms
53,592 KB
testcase_03 AC 39 ms
53,592 KB
testcase_04 AC 34 ms
53,592 KB
testcase_05 AC 37 ms
53,592 KB
testcase_06 AC 35 ms
53,592 KB
testcase_07 AC 34 ms
53,592 KB
testcase_08 AC 35 ms
53,592 KB
testcase_09 AC 34 ms
53,592 KB
testcase_10 AC 83 ms
77,696 KB
testcase_11 AC 88 ms
77,548 KB
testcase_12 AC 141 ms
84,816 KB
testcase_13 AC 121 ms
81,812 KB
testcase_14 AC 145 ms
84,528 KB
testcase_15 AC 156 ms
85,000 KB
testcase_16 AC 100 ms
78,080 KB
testcase_17 AC 139 ms
84,076 KB
testcase_18 AC 77 ms
76,904 KB
testcase_19 AC 87 ms
77,720 KB
testcase_20 AC 140 ms
84,160 KB
testcase_21 AC 108 ms
80,532 KB
testcase_22 AC 175 ms
87,108 KB
testcase_23 AC 171 ms
87,116 KB
testcase_24 AC 97 ms
80,960 KB
testcase_25 AC 119 ms
84,232 KB
testcase_26 AC 83 ms
78,988 KB
testcase_27 AC 129 ms
88,504 KB
testcase_28 AC 60 ms
70,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
G = [[] for i in range(N)]
for _ 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):
    ans += max(0, len(G[i]) - 2)
    
print(ans)
0