Perfect Cube

3.7

13 votes
, Basic Programming, C++
Problem

Given an array  of  integers.

Find the count of subarrays whose product of elements is a perfect cube.

Input Format:

  • First line contains an integer .
  • Next line contains  space-separated integers denoting the array elements.

Output Format:

Print the number of subarrays whose product of elements is a perfect cube.

Constraints:

 

Sample Input
4
2 4 6 36
Sample Output
3
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation
  • Three subarrays with product of elements as a perfect cube are:
    •  product is 
    •  product is 
    •  product is 
Editor Image

?