#SP0000109. Tổng điểm của cây ước (Chef and Divisor Tree)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Tổng điểm của cây ước (Chef and Divisor Tree)
Chef and Divisor Tree
Source: CodeChef
Version: Phuoc Hung OJ Extended
Problem Statement
For a positive integer , build its divisor tree. The root carries . A node labeled has one child for every proper positive divisor of , that is, every positive divisor strictly smaller than . Hence, nodes labeled are leaves. The degree of a node is its number of incident edges in the whole tree; a non-root node has an additional edge to its parent. A root-to-leaf path is scored by the sum of degrees of all nodes along that path. The tree score is the maximum such path score. Given , sum the scores of divisor trees rooted at every integer .
Input
One line contains integers .
Output
Print one integer: the sum of scores for all divisor trees rooted at .
Subtasks
- Subtask 1 (10 points): ; .
- Subtask 2 (25 points): ; .
- Subtask 3 (25 points): ; .
- Subtask 4 (40 points): ; .
Examples
Input
11 12
Output
14
Explanation
For prime , the only root-to-leaf path is , with degrees and ; the score is . For , the path has degrees , summing to . No path has a larger sum, hence .