zoukankan      html  css  js  c++  java
  • 穷举,(一通百通)

    static void Main(string[] args)
            {
                int n = 0;
                for (int x = 1; x*15 <=200; x++)
                {                                                             可能性*可能性*可能性=全部可能性,从中找出符合条件的就OK(if);
                    for (int y = 1; y*3 <=200; y++)
                    {
                        for (int z = 1; z*2 <= 200; z++)
                        {
                            if (x*15+y*3+z*2==200)
                            {
                                Console.WriteLine("羽毛球的结果为"+x+"球的结果为"+y+"水的结果为"+z);
                                n++;
                            }
                        }
                    }
                }
                Console.WriteLine("一共有"+n+"种可能性");

                Console.ReadLine();
            }

  • 相关阅读:
    idea database testconnection 显示灰色
    idea tomcat热部署
    idea 常见报错问题 记录
    Python-Basis-22th
    Python-Basis-21th
    Python-Basis-20th
    Python-Basis-19th
    Python-Basis-18th
    Python-Basis-17th
    Python-Basis-16th
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4388080.html
Copyright © 2011-2022 走看看