#d1303. 三角果计数
三角果计数
Triangle-Fruit Counting
Problem Description
Given a tree with nodes, a "triangle-fruit" is defined as a set of nodes whose pairwise shortest-path distances can form a triangle.
Count how many distinct triangle-fruits the tree has.
Note: two sets are the same if and only if and .
Input Format
The first line contains a positive integer , the number of nodes in the tree.
The next lines each contain three integers , indicating an edge of weight between nodes and .
Output Format
Output one integer: the answer.
Sample Input
7
1 2 1
1 3 1
2 4 1
2 5 1
3 6 1
3 7 1
Sample Output
8
Constraints
For all data: , edge weight , .