Doubles
http://poj.org/problem?id=1552
1 #include<stdio.h> 2 const int N=102; 3 int main() 4 { 5 int n,f[N],g[N]; 6 int cnt; 7 while(1) 8 { 9 cnt = 0; 10 scanf("%d",&n); 11 if (n==-1) 12 break; 13 f[0] = n; 14 g[0] = 2*n; 15 int i ; 16 for ( i = 1;; i ++) 17 { 18 scanf("%d",&f[i]); 19 if (f[i]==0) 20 break; 21 g[i] = 2*f[i]; 22 } 23 for (int j = 0; j < i; j ++) 24 { 25 for (int k = 0; k < i; k ++) 26 { 27 if (f[j]==g[k]) 28 cnt++; 29 } 30 } 31 printf("%d\n",cnt); 32 } 33 return 0; 34 }