結果

問題 No.806 木を道に
ユーザー mencotton
提出日時 2020-11-02 22:14:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 71,128 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 08:09:35
合計ジャッジ時間 2,132 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        a[u - 1]++, a[v - 1]++;
    }

    int ret = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > 2)ret++;
    }
    cout << ret << endl;
    return 0;
}
0