zoukankan      html  css  js  c++  java
  • c# 百鸡百钱

    //公鸡2文,母鸡1文,小鸡半文;100文,买100只鸡;

    int n = 0;
                    for (int i = 1; i < 100/2; i++)
                    {
                        for (int i1 = 1; i1 < 100; i1++)
                        {
                            for (int i2 = 1; i2 < 100/0.5; i2++)
                            {
                                if (i*2+i1+i2*0.5==100&&i+i1+i2==100)
                                {
                                    Console.WriteLine(i+"只公鸡"+i1+"只母鸡"+i2+"只小鸡");
                                    n++;
                                }
                            }
                        }
                    }

                    Console.WriteLine("总共有"+n+"种可能");

                    Console.ReadKey();

  • 相关阅读:
    ajax的基础知识
    前端必备的php的基础知识点
    关于事件的简单汇总
    Django rest-framework(目录)
    Django(目录)
    前端(目录)
    数据库知识(目录)
    数据库基础
    并发编程(目录)
    网络编程
  • 原文地址:https://www.cnblogs.com/lovesy2413/p/4310799.html
Copyright © 2011-2022 走看看