K-Good Trees
Practice
4.4 (10 votes)
Number theory
Math
Factorization
Trees
Mathematics
Number theory
Integer factorization
Problem
47% Success 1801 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Problem:
A tree is called \(K-Good (K \geq 1)\) if all the nodes of the tree have exactly \(K \) children except the leaves. For given count of leaves \(M (M \geq 2)\), find the number of possible values of \(K\).
Input Format:
- The first line of the input contains a single integer \(T\) - the number of test cases. The description of \(T\) test cases follows.
- The first and only line of each test case contains a single integer \(M\).
Output Format:
- For each test case, print the number of possible values of \(K\) for given count of leaves \(M\).
Constraints:
- \(1 \leq T \leq 10^3\)
- \(2 \leq M \leq 10^{9}\)
Submissions
Please login to view your submissions
Similar Problems
Points:20
154 votes
Tags:
Number TheoryEasyReadyMathematicsOpenApprovedFactorization
Points:20
Tags:
Prime FactorizationEasyMathematicsSieveapprovedFactorization
Points:20
13 votes
Tags:
Prime FactorizationEasyMathematicsFactorization
Editorial