public class Solution
 {
     public static void main(String[] args)
     {
         int[] employee = new int[8];
         int[] totalTime = new int[8];
         int temp;

         int[][] detailTime =
         {
             {2, 4, 3, 4, 5, 8, 8},
             {7, 3, 4, 3, 3, 4, 4},
             {3, 3, 4, 3, 3, 2, 2},
             {9, 3, 4, 7, 3, 4, 1},
             {3, 5, 4, 3, 6, 3, 8},
             {3, 4, 4, 6, 3, 4, 4},
             {3, 7, 4, 8, 3, 8, 4},
             {6, 3, 5, 9, 2, 7, 9}
         };

         for(int i = 0; i < 8; i++)
         {
             for(int j = 0; j < 7; j++)
                 totalTime[i] += detailTime[i][j];
             employee[i] = i;
         }

         for(int i = 0; i < 8; i++)
         {
             for(int j = i; j < 8; j++)
             {
                 if(totalTime[j] > totalTime[i])
                 {
                     temp = totalTime[j];
                     totalTime[j] = totalTime[i];
                     totalTime[i] = temp;
                     temp = employee[i];
                     employee[i] = employee[j];
                     employee[j] = temp;
                 }
             }
         }

         for(int i = 0; i < 8; i++)
             System.out.println("Employee " + employee[i] + " work " + totalTime[i] + " hours");
     }
 }

HW7.4的更多相关文章

  1. HW7.18

    public class Solution { public static void main(String[] args) { int[][] m = {{1, 2}, {3, 4}, {5, 6} ...

  2. HW7.17

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  3. HW7.16

    import java.util.Arrays; public class Solution { public static void main(String[] args) { int row = ...

  4. HW7.15

    public class Solution { public static void main(String[] args) { double[][] set1 = {{1, 1}, {2, 2}, ...

  5. HW7.14

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  6. HW7.13

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  7. HW7.12

    import java.util.Scanner; public class Solution { public static void main(String[] args) { double[] ...

  8. HW7.11

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  9. HW7.10

    public class Solution { public static void main(String[] args) { int[][] array = new int[3][3]; for( ...

  10. HW7.9

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

随机推荐

  1. The 6th Zhejiang Provincial Collegiate Programming Contest->Problem I:A Stack or A Queue?

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3210 题意:给出stack和queue的定义,一个是先进后出(FILO), ...

  2. Injection Attacks-Log 注入

    日志注入(也称日志文件注入) 很多应用都维护着一系列面向授权用户.通过 HTML 界面展示的日志,因而成为了攻击者的首要目标,这些攻击者试图伪装其他攻击.误导日志读者,甚至对阅读和分析日志监测应用的用 ...

  3. CodeForces 299A Ksusha and Array

    http://codeforces.com/problemset/problem/299/A 题意 :输入n个数,要求找出一个数能让其他所有的数整除,如果没有的话输出-1.有多个的话输出其中一个. 思 ...

  4. c缺陷与陷阱笔记-第三章 语义陷阱

    1.关于数组和数组指针 数组的名字默认是常量指针,值不能改变的,例如 int a[]={1,2,3,...},这个a的类型时int *,所以如果有int *p,那么a=p是合法的,其他的指针类型,例如 ...

  5. POJ3080——Blue Jeans(暴力+字符串匹配)

    Blue Jeans DescriptionThe Genographic Project is a research partnership between IBM and The National ...

  6. python脚本工具 - 4 获取系统当前时间

    #! /usr/bin/python import time current_time = time.strftime("%Y-%m-%d %H:%M") print curren ...

  7. fork、vfork、clone区别

    在Linux中主要提供了fork.vfork.clone三个进程创建方法. 问题 在linux源码中这三个调用的执行过程是执行fork(),vfork(),clone()时,通过一个系统调用表映射到s ...

  8. Windbg:如何给字符串下条件断点

    因为Windgb支持MASM语法,字符串的比较方法有$scmp和$sicmp.用法和c中的字符串比较方法一致.在需要比较字符串成员变量的时候,遇到了点问题.因为字符串成员变量无法直接获取字符串内容.p ...

  9. ajax返回son数据

    JSON 只是一种文本字符串.它被存储在 responseText 属性中 为了读取存储在 responseText 属性中的 JSON 数据,需要根据 JavaScript 的 eval 语句. 函 ...

  10. PLSQL Developer调试 存储过程和触发器

    1. 打开PL/SQL Developer如果 在机器上安装了PL/SQL Developer的话,打开PL/SQL Developer界面输入 用户名,密码和host名字,这个跟在程序中web.co ...