当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3910:GCD Determinant

题目描述
We say that a set S = {x1, x2, ..., xn} is factor closed if for any xi ∈ S and any divisor d of xi we have d ∈ S. Let’s build a GCD matrix (S) = (sij), where sij = GCD(xi, xj) – the greatest common divisor of xi and xj. Given the factor closed set S, find the value of the determinant:

__poj_jax_start__D_n = \left|{\begin{array}{ccccc}gcd(x_1,x_1)&gcd(x_1,x_2)&gcd(x_1,x_3)&\cdots&gcd(x_1,x_n)\\gcd(x_2,x_1)&gcd(x_2,x_2)&gcd(x_2,x_3)&\cdots&gcd(x_2,x_n)\\gcd(x_3,x_1)&gcd(x_3,x_2)&gcd(x_3,x_3)&\cdots&gcd(x_3,x_n)\\\cdots&\cdots&\cdots&\cdots&\cdots\\gcd(x_n,x_1)&gcd(x_n,x_2)&gcd(x_n,x_3)&\cdots&gcd(x_n,x_n)\end{array}}\right|__poj_jax_end__D_n = \left|{\begin{array}{ccccc}gcd(x_1,x_1)&gcd(x_1,x_2)&gcd(x_1,x_3)&\cdots&gcd(x_1,x_n)\\gcd(x_2,x_1)&gcd(x_2,x_2)&gcd(x_2,x_3)&\cdots&gcd(x_2,x_n)\\gcd(x_3,x_1)&gcd(x_3,x_2)&gcd(x_3,x_3)&\cdots&gcd(x_3,x_n)\\\cdots&\cdots&\cdots&\cdots&\cdots\\gcd(x_n,x_1)&gcd(x_n,x_2)&gcd(x_n,x_3)&\cdots&gcd(x_n,x_n)\end{array}}\right|
输入解释
The input file contains several test cases. Each test case starts with an integer n (0 < n < 1000), that stands for the cardinality of S. The next line contains the numbers of S: x1, x2, ..., xn. It is known that each xi is an integer, 0 < xi < 2*109. The input data set is correct and ends with an end of file.
输出解释
For each test case find and print the value Dn mod 1000000007.
输入样例
2 
1 2 
3 
1 3 9 
4 
1 2 3 6
输出样例
1 
12 
4

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3910

最后修改于 2020-10-29T07:15:10+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536