好多鱼 c语言 编程题
1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 int minSize,maxSize; 6 int n,i,j,eat=0,result=0; 7 int fishSize[4000]={0}; 8 scanf("%d",&minSize); 9 scanf("%d",&maxSize); 10 scanf("%d",&n); 11 for(i=0;i<n;i++) 12 scanf("%d",&fishSize[i]); 13 for(i=minSize;i<=maxSize;i++) 14 { 15 eat=0; 16 for(j=0;j<n;j++) 17 if(i!=0&&fishSize[j]!=0) 18 19 if((fishSize[j]>=i*2&&fishSize[j]<=i*10)||(i>=fishSize[j]*2&&i<=fishSize[j]*10)) 20 {eat=1; 21 break;} 22 if(eat==0) 23 { 24 result++; 25 } 26 27 } 28 printf("%d",result); 29 }