公鸡2文,母鸡1文,小鸡半文,每种至少一只,100文买100只鸡有多少可能性 共有哪几种可能
<script type ="text/javescript"> var n = 0; /var s = 0; for ( var a =1; a<51;a++ ){ for(var b = 1; b<101; b++){ for (var c = 1;c<201; c++ ){ if (a * 2 +b *1 + c * (0.5) ==100 && a +b+c ==100){ n++; s+=(a+"只公鸡,"+b+"只母鸡,"+c+"只小鸡"+ "||") } } } }alert(n); alert(s); </script>