結果

問題 No.806 木を道に
ユーザー 25__toma
提出日時 2019-03-24 04:36:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,032 KB
最終ジャッジ日時 2024-09-25 09:46:55
合計ジャッジ時間 5,748 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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