zoukankan      html  css  js  c++  java
  • 百钱买百鸡(普通算法)

     private void button2_Click(object sender, EventArgs e)
            {
                int x = 0;
                int y = 0;
                int z = 0;

                for (int i = 1; i < 100; i++)
                {
                    for (int j = 1; j < 100; j++)
                    {
                        for (int k = 1; k < 100; k++)
                        {
                            if (5 * i + 3 * j + k / 3 == 100 && i + j + k == 100)
                            {
                                x = i;
                                y = j;
                                z = k;
                                MessageBox.Show("公鸡: " + x + "只,母鸡: " + y + "只,小鸡: " + z + "只", "算出来了");
                            }
                        }
                    }
                }

  • 相关阅读:
    verilog之计数器0~9999——数码管显示
    C语言的谜题
    modelsim SE6.2b的常用问题
    [转载]MDK常见报错(编译arm)
    Nios II之LED实验(SDRAM+EPCS4配置)————基于Altera的DE0开发板
    poj2210
    poj1161
    poj1555
    poj2337
    poj1107
  • 原文地址:https://www.cnblogs.com/armanda/p/2591525.html
Copyright © 2011-2022 走看看