結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,048 KB
testcase_01 AC 29 ms
10,048 KB
testcase_02 AC 28 ms
10,048 KB
testcase_03 AC 29 ms
10,048 KB
testcase_04 AC 31 ms
10,048 KB
testcase_05 AC 32 ms
10,052 KB
testcase_06 AC 29 ms
10,052 KB
testcase_07 AC 29 ms
10,048 KB
testcase_08 AC 29 ms
10,048 KB
testcase_09 AC 28 ms
10,048 KB
testcase_10 AC 96 ms
13,924 KB
testcase_11 AC 91 ms
13,296 KB
testcase_12 AC 294 ms
24,704 KB
testcase_13 AC 216 ms
20,696 KB
testcase_14 AC 275 ms
24,024 KB
testcase_15 AC 298 ms
24,912 KB
testcase_16 AC 124 ms
15,444 KB
testcase_17 AC 255 ms
22,940 KB
testcase_18 AC 54 ms
11,436 KB
testcase_19 AC 99 ms
14,132 KB
testcase_20 AC 255 ms
22,944 KB
testcase_21 AC 157 ms
17,316 KB
testcase_22 AC 340 ms
27,300 KB
testcase_23 AC 342 ms
27,296 KB
testcase_24 AC 187 ms
19,224 KB
testcase_25 AC 266 ms
23,924 KB
testcase_26 AC 120 ms
15,064 KB
testcase_27 AC 336 ms
26,932 KB
testcase_28 AC 38 ms
10,420 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