結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
bamboo_circle
|
| 提出日時 | 2019-03-22 21:41:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 689 bytes |
| コンパイル時間 | 1,293 ms |
| コンパイル使用メモリ | 158,680 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 02:59:47 |
| 合計ジャッジ時間 | 2,778 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
int main(){
int n;
cin >> n;
vector<int> tree(n,0);
rep(i,n-1){
int a,b;
cin >> a >> b;
a--;b--;
tree[a]++;
tree[b]++;
}
int ans = 0;
rep(i,n){
if(tree[i] == 1) ans++;
}
ans -= 2;
cout << ans << '\n';
return 0;
}
bamboo_circle