Special Cube


  • 0

    Given two integers M and N, find the number of distinct pairs of {a, b} so that
    1 <= M, N <= 10^5
    1 <= a <= M,
    1 <= b <= N,
    (a^(1/3) + b^(1/3) )^3 is an integer.

    Example:
    (1)
    M = 1, N = 1
    Answer is 1, because only {1, 1} satisfy the condition.

    (2)
    M = 1, N = 8
    Answer is 2, because {1, 1} and {1, 8} satisfy the condition.

    (3)
    M = 2, N = 2
    Answer is 2, because {1, 1} and {2, 2} satisfy the condition.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.