Answers for "usaco silver 2019 grass planting solution"

C++
0

usaco silver 2019 grass planting solution

#include <iostream>
using namespace std;
 
int N,a,b;
int d[100000];
 
int main()
{
	cin >> N;
	for(int i=1;i<N;i++)
	{
		cin >> a >> b;
		d[a-1]++, d[b-1]++;
	}
	int D = 0;
	for(int i=0;i<N;i++)
		if(d[i] > D)
			D = d[i];
	cout << D+1 << '\n';
}
Posted by: Guest on July-02-2020

Browse Popular Code Answers by Language