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

建议使用的浏览器:

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

4583:Coffee shop in Jioufen

题目描述
Cheer manages a coffee shop in Jioufen. As she is the only assistant in the shop, it is a big problem for her to mix up raw materials into a cup of coffee.
To simplify the problem, we can assume that Cheer has n kinds of raw material, and the i-th raw material has been assigned with a value ai denoting its level of deliciousness.
For some unknown reason, Cheer believe that a kind of coffee is perfect if and only if the value of its all kinds of raw materials are co-prime with each other. A kind of perfect coffee also can be made without any of these raw materials, only by water.
Now given n kinds of raw material and their value of deliciousness, find out how many distinct kinds of perfect coffee can be made by them. Note that two kinds of coffee are considered distinct if and only if the raw material sets of them are distinct.
输入解释
There are at most 75 test cases.
For each case, The first line contains one integer n indicating the number of kind of raw material.
The next line contains n integers separated by space, denoting deliciousness values: a1, a2, ..., an
(1 <= n <= 60, 1 <= ai <= 231-1)
The input ends with n = 0
输出解释
For each test case, print the number of distinct kind of prefect coffee she can made in one line.
输入样例
2
2 2
3
1 2 3
3
2 3 4
0
输出样例
3
8
6
提示
For the first case, there 3 distinct kinds of perfect coffee: none of these raw materials, only with the first kind of raw material, and only with the second kind of raw material. Coffee with both the first kind of raw material and the second is not considered as perfect coffee, because the deliciousness levels of first kind of raw material and the second are not co-prime.
来自杭电HDUOJ的附加信息
Recommend

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4583

最后修改于 2020-10-25T23:14:53+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 65535/65536K(Java/Others)