1 #include <stdio.h> 2 #include <stdlib.h> 3 int nums[16]; 4 5 int cmp(const void *a, const void *b) 6 { 7 return *(int*)a - *(int*)b; 8 } 9 10 int main() 11 { 12 int n,i,j,result; 13 while(scanf("%d",&n) && n != -1) 14 { 15 i = result = 0; 16 nums[i] = n; 17 ++i; 18 while(scanf("%d",&n) && n) 19 { 20 nums[i] = n; 21 ++i; 22 } 23 24 n = i; 25 qsort(nums,i,sizeof(nums[0]),cmp); 26 for(i = 0; i < n; ++i) 27 { 28 for(j = i+1; j < n; ++j) 29 { 30 if(nums[j]/nums[i] == 2 && nums[j]%nums[i] == 0) 31 { 32 ++result; 33 break; 34 } 35 } 36 } 37 printf("%d\n",result); 38 } 39 }
时间: 2024-12-27 23:17:09