标签:
class Program { static void Main(string[] args) { while (true) { int n = 0; for (int g = 1; g*2 <=100; g++) { for (int m = 1; m*1 <=100; m++) { for (int x = 1; x*0.5 <=100; x++) { if(g*2+m*1+x*0.5==100&&g+m+x==100) { Console.WriteLine(g+"只公鸡"+m+"只母鸡"+x+"只小鸡"); n++; } } } } Console.WriteLine("共有"+n+"种可能性"); Console.ReadLine(); } } } }
标签:
原文地址:http://www.cnblogs.com/w-wz/p/4439662.html