-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathF1.cpp
More file actions
54 lines (51 loc) · 1.01 KB
/
F1.cpp
File metadata and controls
54 lines (51 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef double R;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, s, t) for(i = (s); i < (t); i++)
#define RFOR(i, s, t) for(i = (s)-1; i >= (t); i--)
const R PI = acos(-1);
const int MAXN = 1<<20;
const int P = 1e9+7;
int deg[MAXN];
vector<int> e[MAXN];
int main(){
#ifdef LOCAL
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif
int n;
int i, j, k;
scanf("%d", &n);
for(i = 01; i < n; i++){
int a, b;
scanf("%d%d", &a, &b);
deg[a]++;
deg[b]++;
e[a].pb(b);
e[b].pb(a);
}
ll ans = 0;
for(i = 1; i <= n; i++)
ans += (ll)deg[i] * (deg[i]-1) / 2;
cout<<ans<<endl;
return 0;
}