Problem 3777 --Minimum spanning tree

3777: Minimum spanning tree

"
Time Limit $1$ 秒/Second(s) Memory Limit $128$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
Given n-1 points, numbered from 2 to n, the edge weight between the two points a and b is lcm(a, b). Please find the minimum spanning tree formed by them.

A minimum spanning tree is a subset of the edges of a connected, edge-weighted undirected graph that connects all the vertices together, without any cycles and with the minimum possible total edge weight. That is, it is a spanning tree whose sum of edge weights is as small as possible.

lcm(a, b) is the smallest positive integer that is divisible by both a and b.
The first line contains a single integer t (t<=100) representing the number of test cases in the input. Then t test cases follow.

The only line of each test case contains one integers n (2<=n<=10000000) as mentioned above.
For each test case, print one integer in one line, which is the minimum spanning tree edge weight sum.
2
2
6
0
26

推荐代码 查看3777 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛