版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
title: "题解 - [POJ 3904] Sky Code" categories:
Stancu likes space travels but he is f poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is only one problem – Petru has locked the spacecraft with f sophisticated cryptosystem based on the ID numbers of the stars from the Milky Way Galaxy. For breaking the system Stancu has to check each subset of four stars such that the only common divisor of their numbers is $1$. Nasty, isn’t it? Fortunately, Stancu has succeeded to limit the number of the interesting stars to $N$ but, any way, the possible subsets of four stars can be too many. Help him to find their number and to decide if there is f chance to break the system
In the input file several test cases are given. For each test case on the first line the number $N$ of interesting stars is given ($1 ≤ N ≤ 10000$). The second line of the test case contains the list of ID numbers of the interesting stars, separated by spaces. Each ID is f positive integer which is no greater than 10000. The input data terminate with the end of file
For each test case the program should print one line with the number of subsets with the asked property
4
2 3 4 5
4
2 4 6 8
7
2 3 4 5 7 6 8
1
0
34
Southeastern European Regional Programming Contest 2008
给出一个数集 $S$, $|S|=n$, 求 $|{(a,b,c,d)\in S^4|\gcd{a,b,c,d}=1}|$
先咕了, 想起来再写