zoukankan      html  css  js  c++  java
  • 5月14日 组钱:用1分、2分、5分,组成6角

    namespace 组6角钱
    {
        class Program
        {
            public void qian()
            {
                int count = 0;
                for (int yf = 0; yf <= 60; yf++)
                {
                    for (int ef = 0; ef <= 30; ef++)
                    {
                        for (int wf = 0; wf <= 12; wf++)
                        {
                            
                            if (yf * 1 + ef * 2 + wf * 5 == 60)
                            {
                                count++;
                                Console.WriteLine("" + count + "种组合方法:一分" + yf + "个,二分" + ef + "个,五分" + wf + "个!");
                            }
                        }
                    }
                }
                Console.WriteLine("总共" + count + "种组合方法!");        
            }
    
    
            static void Main(string[] args)
            {
                Program hanshu = new Program();
    
                //3、有1分钱,2分钱,5分钱的硬币,要组合出来6角钱,有几种组合方式,分别各多少个
                //6角=60分
                //int count = 0;//数数,符合题意的组合方法
                //int bian = 0;//总循环遍数
                //for (int yf = 0; yf <= 60; yf++)
                //{
                //    for (int ef = 0; ef <= 30; ef++)
                //    {
                //        for (int wf = 0; wf <= 12; wf++)
                //        {
                //            bian++;
                //            if (yf * 1 + ef * 2 + wf * 5 == 60)
                //            {
                //                count++;
                //                Console.WriteLine("第" + count + "种组合方法:一分" + yf + "个,二分" + ef + "个,五分" + wf + "个!");
                //            }
                //        }
                //    }
                //}
                //Console.WriteLine("总共"+count+"种组合方法!");
                //Console.WriteLine("总共循环" + bian + "遍!");
    
                hanshu.qian();
    
                Console.ReadLine();
            }
        }
    }
  • 相关阅读:
    分布式文件存储系统-HDFS
    Java中的常用类
    分布式协调框架ZooKeeper
    【Redis】Redis慢查询
    kubectl工具管理应用
    kubectl命令管理
    To check your hdfs port use the following command in linux
    hadoop HDFS常用文件操作命令
    在scala中关于split以及正则表达式
    pandas入门之Series
  • 原文地址:https://www.cnblogs.com/juyangchao12/p/5494691.html
Copyright © 2011-2022 走看看