[BOJ 1335] 여섯 쌍 서로소

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 512M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

$N$개의 정수 $X_1, X_2, \dots X_N$가 있다. $Y_{i,j} = X_i \times X_j \bmod {359999}$ 이다.</p>

다음 조건을 만족하는 $(a, b, c, d, e, f)$의 개수를 구해보자.

  • $1 \le a, b, c, d, e, f \le N$
  • $gcd(Y_{a,b}, Y_{c,d}, Y_{e,f}) = 1$

$gcd(0, 0) = 0$이다.

입력 형식

첫째 줄에 $N$, 둘째 줄에 $X_1, X_2, \dots X_N$이 주어진다.

출력 형식

문제 조건을 만족하는 $(a, b, c, d, e, f)$의 개수를 $10^9 + 7$로 나눈 나머지를 출력한다.

예제 입력

3
300 3000 30000

예제 출력

234

Comments

There are no comments at the moment.