题目描述
Problem Description
There is a graph of n vertices which are indexed from 1 to n. For any pair of different vertices, the weight of the edge between them is the least common multiple of their indexes.
Mr. Frog is wondering about the total weight of the minimum spanning tree. Can you help him?
Input
The first line contains only one integer T (T≤100), which indicates the number of test cases.
For each test case, the first line contains only one integer n (2≤n≤109), indicating the number of vertices.
Output
For each test case, output one line “Case #x:y”,where x is the case number (starting from 1) and y is the total weight of the minimum spanning tree.
Sample Input
Sample Output
题目分析
题目大意:建图,求图最小边权和:边权为两点序号的。
我们很容易想到:使每条边权最小的时候,应该将所有的点与1点相连,使得所有边权最小化。
因此图的结构被确定了,每条边的边权也唯一固定:。可以推出以下公式:
AC Code