Two divisors

1.8

4 votes
dynamic programming, algorithms, medium, Dynamic Programming
Problem

You are given an integer N. You have to find how many numbers (X) exist for the given N such that 1xN and the number of divisors of X is a power of 2 .

Input format

  • First line: Q (number of queries)
  • Next line: Q space-separated integer such that the ith integer is N for the ith query

Output format
Print a single integer denoting the number of valid 1xN for each query as space-separated integers.

Constraints

  • 1Q106
  • 1N106
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

For N=3

Number of divisors of 1=1 (can be represented as 20)

Number of divisors of 2=2 (can be represented as 21)

Number of divisors of 3=2 (can be represented as 21)

Therefore, the total count of valid x(1x3) is 3.

Editor Image

?