题目链接:https://acs.jxnu.edu.cn/problem/HDU1303
As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked to determine how many items in each list are twice some other item in the same list. You will need a program to help you with the grading. This program should be able to scan the lists and output the correct answer for each one. For example, given the list
1 4 3 2 9 7 18 22
your program should answer 3, as 2 is twice 1, 4 is twice 2, and 18 is twice 9.
输入:
The input file will consist of one or more lists of numbers. There will be one list of numbers per line. Each list will contain from 2 to 15 unique positive integers. No integer will be larger than 99. Each line will be terminated with the integer 0, which is not considered part of the list. A line with the single number -1 will mark the end of the file. The example input below shows 3 separate lists. Some lists may not contain any doubles.
输出:
The output will consist of one line per input list, containing a count of the items that are double some other item.
作为算法组的一部分,你的同学们将被随机分到从2到15个唯一的正整数的列表,而且要求确定每个列表中有多少项是两次 在同一列表中的其他一些项目。你将需要设计一个程序来帮助你。这个程序需要能够扫描列表并输出每个列表的正确答案。例如,给定列表1 4 3 2 9 7 18 22你的程序应该回答3,因为2是1的2倍,4是2的2倍2,18是9的2倍。
输入:
输入将由一个或多个数字列表组成。每行将会有一个数字列表。每个列表将包含从2到15个唯一的正整数。任何整数都不会大于99.每一行都将以整数0结尾,默认它不是列表的一部分。编号为-1的一行将表示结束。下面的示例输入显示了3个单独的列表.有些列表可能不包含任何双数。
输出:
输出将由每个输入列表的一行组成,包含其他项的计数。