版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jingmin52296358al/article/details/52116977
#include<iostream>
using namespace std;
int main()
{
int i,j,a[20],n;
cin>>a[0];
while(a[0]!=-1)
{
int n=1;
for(;;n++)
{
cin>>a[n];
if(a[n]==0)break;
}
int count=0;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]==a[j]*2||a[j]==a[i]*2)
count++;
}
}
cout<<count<<endl;
cin>>a[0];
}
return 0;
}