結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,996 KB
testcase_01 AC 27 ms
9,996 KB
testcase_02 AC 28 ms
9,996 KB
testcase_03 AC 30 ms
9,996 KB
testcase_04 AC 28 ms
9,996 KB
testcase_05 AC 28 ms
10,000 KB
testcase_06 AC 28 ms
10,000 KB
testcase_07 AC 28 ms
9,996 KB
testcase_08 AC 27 ms
9,996 KB
testcase_09 AC 28 ms
9,996 KB
testcase_10 AC 92 ms
13,872 KB
testcase_11 AC 83 ms
13,244 KB
testcase_12 AC 273 ms
24,652 KB
testcase_13 AC 202 ms
20,644 KB
testcase_14 AC 255 ms
23,972 KB
testcase_15 AC 278 ms
24,860 KB
testcase_16 AC 116 ms
15,392 KB
testcase_17 AC 242 ms
22,888 KB
testcase_18 AC 52 ms
11,384 KB
testcase_19 AC 95 ms
14,080 KB
testcase_20 AC 242 ms
22,892 KB
testcase_21 AC 153 ms
17,264 KB
testcase_22 AC 326 ms
27,248 KB
testcase_23 AC 325 ms
27,244 KB
testcase_24 AC 175 ms
19,172 KB
testcase_25 AC 254 ms
23,872 KB
testcase_26 AC 114 ms
15,012 KB
testcase_27 AC 311 ms
26,880 KB
testcase_28 AC 33 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