题库练习 On the Bench
← 上一题 下一题 →

A11129 | On the Bench

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

A year ago on the bench in public park Leha found an array of $n$ numbers. Leha believes that permutation $p$ is right if for all $1<=i<n$ condition, that $a_{pi}·a_{pi+1}$ is not perfect square, holds. Leha wants to find number of right permutations modulo $10^{9}+7$ .

输入格式

First line of input data contains single integer $n$ ( $1<=n<=300$ ) — length of the array.

Next line contains $n$ integers $a_{1},a_{2},...\ ,a_{n}$ ( $1<=a_{i}<=10^{9}$ ) — found array.

输出格式

Output single integer — number of right permutations modulo $10^{9}+7$ .

输入输出样例

输入 #1
3
1 2 4
输出 #1
2
输入 #2
7
5 2 4 2 4 1 1
输出 #2
144
C++ 编辑器
输入
输出