結果

問題 No.806 木を道に
ユーザー 25__toma25__toma
提出日時 2019-03-24 04:37:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 330 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 11,788 KB
実行使用メモリ 27,248 KB
最終ジャッジ日時 2023-10-26 01:40:08
合計ジャッジ時間 5,102 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
9,996 KB
testcase_01 AC 25 ms
9,996 KB
testcase_02 AC 25 ms
9,996 KB
testcase_03 AC 27 ms
9,996 KB
testcase_04 AC 26 ms
9,996 KB
testcase_05 AC 27 ms
10,000 KB
testcase_06 AC 25 ms
10,000 KB
testcase_07 AC 26 ms
9,996 KB
testcase_08 AC 26 ms
9,996 KB
testcase_09 AC 27 ms
9,996 KB
testcase_10 AC 94 ms
13,872 KB
testcase_11 AC 82 ms
13,244 KB
testcase_12 AC 280 ms
24,652 KB
testcase_13 AC 202 ms
20,644 KB
testcase_14 AC 258 ms
23,972 KB
testcase_15 AC 281 ms
24,860 KB
testcase_16 AC 122 ms
15,392 KB
testcase_17 AC 240 ms
22,888 KB
testcase_18 AC 51 ms
11,384 KB
testcase_19 AC 94 ms
14,080 KB
testcase_20 AC 245 ms
22,892 KB
testcase_21 AC 150 ms
17,264 KB
testcase_22 AC 321 ms
27,248 KB
testcase_23 AC 330 ms
27,244 KB
testcase_24 AC 176 ms
19,172 KB
testcase_25 AC 256 ms
23,872 KB
testcase_26 AC 115 ms
15,012 KB
testcase_27 AC 320 ms
26,880 KB
testcase_28 AC 34 ms
10,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
edges=[[int(j) for j in input().split()] for i in range(N-1)]

cnts=[0 for i in range(N+1)]
for edge in edges:
    cnts[edge[0]]+=1
    cnts[edge[1]]+=1

solo=0
for cnt in cnts:
    if cnt==1:
        solo+=1
print(solo-2)
0