编程介的小学生 2017-11-17 10:52 采纳率: 20.5%
浏览 335
已结题

Coffee shop in Jioufen

Problem Description
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.

Input
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

Output
For each test case, print the number of distinct kind of prefect coffee she can made in one line.

Sample Input
2
2 2
3
1 2 3
3
2 3 4
0

Sample Output
3
8
6

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站