#include <stdio.h>
#include <stdlib.h> int main()
{
int numList[],th=,i,j;
while(scanf("%d",&numList[th++])!=EOF){
int count=;
if(numList[]==-)
break;
while(scanf("%d",&numList[th])!=EOF)
{
if(numList[th]==)
break;
++th;
}
for(i=;i<th-;i++)
{
for(j=i+;j<=th-;j++)
{
if((float)numList[i]/numList[j]==0.5 || (float)numList[i]/numList[j]==2.0)
count++;
}
}
printf("%d\n",count);
th=;
}
return ;
}
另外附一个可读性更高的
http://www.cnblogs.com/rainydays/archive/2013/04/03/2998275.html