結果

問題 No.806 木を道に
ユーザー Woo-CieWoo-Cie
提出日時 2019-03-22 21:41:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 873 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 11,920 KB
実行使用メモリ 42,292 KB
最終ジャッジ日時 2023-10-19 06:51:28
合計ジャッジ時間 21,386 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 497 ms
42,292 KB
testcase_01 AC 494 ms
42,292 KB
testcase_02 AC 495 ms
42,288 KB
testcase_03 AC 491 ms
42,292 KB
testcase_04 AC 493 ms
42,292 KB
testcase_05 AC 500 ms
42,288 KB
testcase_06 AC 499 ms
42,292 KB
testcase_07 AC 496 ms
42,292 KB
testcase_08 AC 500 ms
42,288 KB
testcase_09 AC 502 ms
42,292 KB
testcase_10 AC 581 ms
42,292 KB
testcase_11 AC 566 ms
42,288 KB
testcase_12 AC 808 ms
42,292 KB
testcase_13 AC 724 ms
42,292 KB
testcase_14 AC 787 ms
42,288 KB
testcase_15 AC 821 ms
42,288 KB
testcase_16 AC 610 ms
42,292 KB
testcase_17 AC 771 ms
42,292 KB
testcase_18 AC 522 ms
42,292 KB
testcase_19 AC 575 ms
42,292 KB
testcase_20 AC 772 ms
42,292 KB
testcase_21 AC 654 ms
42,288 KB
testcase_22 AC 873 ms
42,292 KB
testcase_23 AC 872 ms
42,288 KB
testcase_24 AC 695 ms
42,292 KB
testcase_25 AC 796 ms
42,288 KB
testcase_26 AC 605 ms
42,292 KB
testcase_27 AC 854 ms
42,288 KB
testcase_28 AC 506 ms
42,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8-*-
import numpy as np

n = int(input())
v = np.zeros((n))

for i in range(n-1):
    a, b = map(int, input().split(" "))
    v[a-1] += 1
    v[b-1] += 1
a = 0
for i in range(n):
    if v[i] > 2:
        a += (v[i]-2)
print(int(a))

0