Untitled

mail@pastecode.io avatar
unknown
plain_text
13 days ago
689 B
0
Indexable
Never
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n"
 
const double PI = 3.14159265358979;
const ll INF =  1e9 + 7;
const ll MOD = 1e9 + 7;
const ll nax = 2505;
const int LOG = 25;


void solve() {
    int n;
    cin >> n;
    vector<int> deg(n + 1, 0);

    for (int i = 1; i < n; i++) {
        int x, y;
        cin >> x >> y;
        deg[x]++;
        deg[y]++;
    }

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = max(ans, deg[i]);
    }

    cout << ans + 1;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    // int t; cin >> t; while(t--)
    solve();
    return 0;
}
Leave a Comment