zoukankan      html  css  js  c++  java
  • 韩信将兵(普通算法)

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

                for (int i = 1; i <= 33; i++)
                {
                    for (int j = 1; j <= 14; j++)
                    {
                        for (int k = 1; k <= 20; k++)
                        {
                            if (3 * i +1 == 7 * j  -2&& 7 * j -2 == 5 * k)
                            {
                                x = i;
                                y = j;
                                z = k;
                            }
                        }
                    }
                }
                MessageBox.Show("算出来了" +(3*x +1) + "人,3人一行排列" + x + "行,7人一行排列" + y +"行,5人一行排列" +z+"行","韩信将兵人数");
            }

  • 相关阅读:
    算法之递归
    初读 c# IL中间语言
    sql语句转为Model
    WPF-悬浮窗(类似于360)
    call,apply
    作用域题目
    css BFC
    数组扁平化 flatten
    常见的异步题
    setTimeout、Promise、Async/Await 的区别
  • 原文地址:https://www.cnblogs.com/armanda/p/2591511.html
Copyright © 2011-2022 走看看