結果

問題 No.806 木を道に
ユーザー onsen_manjuuu
提出日時 2020-08-29 03:07:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 1,884 ms
コンパイル使用メモリ 169,484 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-14 04:58:07
合計ジャッジ時間 3,567 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

int main()
{
	int n;
	cin >> n;
	vector<int> dig(n);
	for(int i = 0; i < n - 1; i++) {
		int a, b; cin >> a >> b;
		dig[a]++;dig[b]++;
	}
	int cnt = 0;
	for(auto i : dig)cnt += max(0, i - 2);
	cout << cnt << endl;
}
0