zoukankan      html  css  js  c++  java
  • Java实现考察团组成

    考察团组成

    某饭店招待国外考察团。按照标准,对领导是400元/人,随团职员200元/人,对司机50元/人。
    考察团共36人,招待费结算为3600元,请问领导、职员、司机各几人。
    答案是三个整数,用逗号分隔。

    参考答案:
    3,5,28

    public class Main {
        
        public void printResult() {
            for(int a = 0;a <= 36;a++) {
                for(int b = 0;b <= 36;b++) {
                    for(int c = 0;c <= 36;c++) {
                        if(a + b + c == 36) {
                            int temp = a * 400 + b * 200 + c * 50;
                            if(temp == 3600)
                                System.out.println(a+", "+b+", "+c);
                        }
                    }
                }
            }
            return;
        }
        
        public static void main(String[] args) {
            Main test = new Main();
            test.printResult();
        }
    }
    
  • 相关阅读:
    python
    爬虫
    python 自动登录
    day22 cookie session 中间件 Form
    day10进程、异步IO、
    python第五课
    day21
    day20 Django
    day 19
    day18
  • 原文地址:https://www.cnblogs.com/a1439775520/p/13077083.html
Copyright © 2011-2022 走看看