結果

問題 No.806 木を道に
ユーザー hedwig100hedwig100
提出日時 2020-04-22 22:17:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 480 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 27,648 KB
最終ジャッジ日時 2024-04-20 10:49:16
合計ジャッジ時間 6,545 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,880 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,880 KB
testcase_06 AC 29 ms
10,752 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 29 ms
10,880 KB
testcase_09 AC 27 ms
10,752 KB
testcase_10 AC 120 ms
14,464 KB
testcase_11 AC 104 ms
13,952 KB
testcase_12 AC 406 ms
24,832 KB
testcase_13 AC 294 ms
21,120 KB
testcase_14 AC 368 ms
24,064 KB
testcase_15 AC 412 ms
25,216 KB
testcase_16 AC 160 ms
15,872 KB
testcase_17 AC 345 ms
23,168 KB
testcase_18 AC 65 ms
12,160 KB
testcase_19 AC 128 ms
14,592 KB
testcase_20 AC 341 ms
23,040 KB
testcase_21 AC 211 ms
17,664 KB
testcase_22 AC 480 ms
27,392 KB
testcase_23 AC 475 ms
27,264 KB
testcase_24 AC 230 ms
19,456 KB
testcase_25 AC 336 ms
23,936 KB
testcase_26 AC 147 ms
16,000 KB
testcase_27 AC 411 ms
27,648 KB
testcase_28 AC 41 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
G = [[] for _ in range(n)]
for _ in range(n - 1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

ans = 0
for i in range(n):
    if len(G[i]) >= 3:
        ans += len(G[i]) - 2
print(ans)
0