結果
問題 | No.806 木を道に |
ユーザー |
![]() |
提出日時 | 2019-03-22 21:43:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 416 ms / 2,000 ms |
コード長 | 293 bytes |
コンパイル時間 | 147 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,120 KB |
最終ジャッジ日時 | 2024-09-19 03:12:43 |
合計ジャッジ時間 | 6,566 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
N = int(input()) D = {} for i in range(N-1) : a,b = map(int,input().split()) if a not in D : D[a] = 1 else : D[a] += 1 if b not in D : D[b] = 1 else : D[b] += 1 ans = 0 for i in D.values() : if i >= 3 : ans += i - 2 print(ans)