結果
問題 | No.806 木を道に |
ユーザー |
![]() |
提出日時 | 2019-05-17 15:36:22 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 347 ms / 2,000 ms |
コード長 | 425 bytes |
コンパイル時間 | 141 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-09-17 05:55:46 |
合計ジャッジ時間 | 5,490 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
node_num = int(input()) nodes_count = [0] * node_num answer = 0 for i in range(node_num - 1): first, second = map(int, input().split()) firstIndex = first - 1 secondIndex = second - 1 if nodes_count[firstIndex] == 2: answer += 1 else: nodes_count[firstIndex] += 1 if nodes_count[secondIndex] == 2: answer += 1 else: nodes_count[secondIndex] += 1 print(answer)