zoukankan      html  css  js  c++  java
  • c#,关于for穷举例题

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace for穷举
    {
        class Program
        {
            static void Main(string[] args)
            {
                int cishu = 0;
                for (int x = 0; x <= 150;x++ )
                {
                    for (int y = 0; y <= 75;y++ )
                    {
                        for (int z = 0; z <= 30;z++ )
                        {
                            if (x * 1 + y * 2 + z * 5 == 150)
                            {
                                cishu++;
                                Console.WriteLine("第"+cishu+"种买法,"+x+"个一分,"+y+"个两分,"+z+"个五分");
                            }
                        }
                    }
                }
                Console.WriteLine("一共有"+cishu+"买法");

            }
        }
    }

  • 相关阅读:
    类的加载过程
    ASCII码表
    uboot main_loop函数分析
    串行CPU设计
    __attribute__ ((section(".text")))的测试
    NandFlash
    测试gcc的优化选项
    如何编写一个简单的makefile
    UBOOT的多支持性与可裁剪性
    函数指针的使用
  • 原文地址:https://www.cnblogs.com/jiang2538406936/p/5160537.html
Copyright © 2011-2022 走看看