report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Square number - MarisaOJ: Marisa Online Judge

Square number

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ of $n$ integers. Count the number of pairs $i < j$ that $A_i \times A_j$ is a square number. ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $A_i$. ### Output - Print the number of pairs $i < j$ that $A_i \times A_j$ is a square number. ### Constraints - $1 \le n \le 3 \times 10^5$. - $1 \le A_i \le 10^6$. ### Example Input: ``` 4 1 2 4 8 ``` Output: ``` 2 ```
Basic number theory
Prime number 2
Sieve of Eratosthenes
Segmented sieve
Prime factors
Maximum GCD
Divisors counting
Largest common divisor
Nearest Element
Divisors counting 2
GCD and LCM
GGCD
Square root sum
Square number
Sum sum sum
Topic
Math
Rating 1300
Solution (2) Solution