結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
mathda1
|
| 提出日時 | 2019-03-22 21:36:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 2,000 ms |
| コード長 | 714 bytes |
| コンパイル時間 | 1,302 ms |
| コンパイル使用メモリ | 159,412 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 02:55:55 |
| 合計ジャッジ時間 | 3,027 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
const int MOD = 1000000007;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
ll num[100005];
int main(){
ll n;
cin >> n;
REP(i,n-1){
ll a,b; cin >> a >> b;
a--; b--;
num[a]++;
num[b]++;
}
ll one = 0;
REP(i,n){
if(num[i]==1)one++;
}
cout << one - 2 << endl;
}
mathda1