結果

問題 No.806 木を道に
ユーザー tobusakanatobusakana
提出日時 2022-11-27 15:51:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 88,656 KB
最終ジャッジ日時 2024-04-14 23:29:17
合計ジャッジ時間 4,217 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,052 KB
testcase_01 AC 39 ms
53,152 KB
testcase_02 AC 38 ms
53,684 KB
testcase_03 AC 38 ms
52,740 KB
testcase_04 AC 36 ms
53,280 KB
testcase_05 AC 43 ms
52,960 KB
testcase_06 AC 38 ms
53,616 KB
testcase_07 AC 38 ms
52,592 KB
testcase_08 AC 37 ms
53,280 KB
testcase_09 AC 38 ms
52,328 KB
testcase_10 AC 91 ms
77,908 KB
testcase_11 AC 90 ms
78,008 KB
testcase_12 AC 161 ms
84,988 KB
testcase_13 AC 137 ms
81,980 KB
testcase_14 AC 164 ms
84,884 KB
testcase_15 AC 168 ms
85,376 KB
testcase_16 AC 99 ms
78,640 KB
testcase_17 AC 152 ms
84,252 KB
testcase_18 AC 82 ms
77,092 KB
testcase_19 AC 92 ms
78,084 KB
testcase_20 AC 153 ms
84,468 KB
testcase_21 AC 114 ms
80,716 KB
testcase_22 AC 184 ms
87,360 KB
testcase_23 AC 184 ms
87,408 KB
testcase_24 AC 102 ms
81,420 KB
testcase_25 AC 119 ms
84,552 KB
testcase_26 AC 87 ms
79,292 KB
testcase_27 AC 138 ms
88,656 KB
testcase_28 AC 65 ms
70,092 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 v in range(N):
    if len(G[v]) >= 3:
       ans += len(G[v]) - 2
       
print(ans)
0