笔试讨论|9.8华为笔试你发挥怎么样,分享一下吧~

5k+人参加了今天华为的校招笔试~

你考得如何?来分享一下吧~
祝大家都能收获理想的offer!

按要求发布题解,有机会获得牛客T恤哦~
#华为#
全部评论
你好,我的会议室安排就过了20%,能讨论下吗
点赞 回复
分享
发布于 2018-09-08 20:44
0.6 0.5 1,最后还剩20分钟放弃了……
点赞 回复
分享
发布于 2018-09-08 20:45
联想
校招火热招聘中
官网直投
我的第一题过了40%,大家能讨论下自己的思路吗
点赞 回复
分享
发布于 2018-09-08 20:48
那个报文什么东西,我擦,难道是我理解的有问题? 比方说插一个200的头报文,最大长度2048,有1700,XXX,XXX,是不是应该把200插到1700前? 还是200头报文,最大长度2048,有1900,100,XXX,是不是应该把1900放到100前面?这样一共移动2000<2048 但是一直WA。。。 第二题第三题很简单,我的是排会议室和走迷宫
点赞 回复
分享
发布于 2018-09-08 20:50
排会议室一直是0,好想知道错哪了···
点赞 回复
分享
发布于 2018-09-08 21:05
第二题的“最大化利用”指的是“总占用时间最长”还是“总占用会议最多”?
点赞 回复
分享
发布于 2018-09-08 21:13
华为不是考编程,是考阅读理解
点赞 回复
分享
发布于 2018-09-08 21:18
public class Main16 {     static class Point implements Comparable<Point> {         int x;         int y;         public Point(int x, int y) {             super();             this.x = x;             this.y = y;         }         @Override         public boolean equals(Object obj) {             if (this == obj)                 return true;             if (obj == null)                 return false;             if (!(obj instanceof Point))                 return false;             Point other = (Point) obj;             return this.x == other.x && this.y == other.y;         }         @Override         public String toString() {             return x + "," + y;         }         private int dis() {             return this.y - this.x;         }         @Override         public int compareTo(Point o) {             if (o.dis() - this.dis() > 0)                 return 1;             else if (o.dis() - this.dis() < 0)                 return -1;             else {                 return this.x - o.x;             }         }     }     public static void main(String[] args) {         Scanner scanner = new Scanner(System.in);         List<Point> list = new ArrayList<>();         while (true) {             String s = scanner.nextLine();             if (s.equals("0,0")) {                 break;             } else {                 String[] ss = s.split(",");                 list.add(new Point(Integer.parseInt(ss[0]), Integer.parseInt(ss[1])));             }         }         Collections.sort(list);         // System.out.println(list);         List<Point> ret = handle(list);         for (Point p : ret) {             System.out.println(p);         }         return;     }     public static List<Point> handle(List<Point> list) {         int n = list.size();         boolean[] flag = new boolean[n];         for (int i = 0; i < n - 1; i++) {             Point p1 = list.get(i);             Point p2 = list.get(i + 1);             if (p2.x >= p1.y || p2.y <= p1.x) {                 continue;             } else {                 flag[i + 1] = true;             }         }         for (int i = 0; i < n; i++) {             if (flag[i])                 list.remove(i);         }         return list;     } }
点赞 回复
分享
发布于 2018-09-08 21:24
笔试第二题题解,JAVA版本,有详细的说明 import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.Scanner; public class Main {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         //分析:优先顺序从持续时间——》开始时间。         //先存储所有输入         while (in.hasNext()) {             String line = in.nextLine();             boolean flag = true;             if (line.equals("0")) {         //结束所有用例                 break;             } else {                 ArrayList<Node> dList = new ArrayList<>();                 while (in.hasNext()) {                     if (!flag) {                         line = in.nextLine();                     } else {                         flag = false;                     }                     if (line.equals("0,0")) {         //结束当前用例                         break;                     } else {                         int i = 0;                         //针对每一个用例                         String[] list = line.split(",");                         int s = Integer.valueOf(list[0]);                         int e = Integer.valueOf(list[1]);                         if (s >= 8 && e <= 21) {                             int d = e - s;                             Node node = new Node(i, s, e, d);                             dList.add(node);                         }                     }                 }                 //调用函数处理,并打印结果                 func(dList);                 //输出结果                 //构造排序的类进行输出                 ArrayList<ResultNode> resList = new ArrayList<>();                 for (int i = 0; i < res.size() - 1; i = i + 2) {                     int st = res.get(i);                     int end = res.get(i + 1);                     ResultNode node = new ResultNode(st, end);                     resList.add(node);                 }                 //打印结果                 Collections.sort(resList);                 for (ResultNode node : resList) {                     System.out.print(node.statr + "");                     System.out.print("," + node.end);                     System.out.println();                 }             }         }     }     /**      * 处理每一个用例      */     private static LinkedList<Integer> res = new LinkedList<>();  //存储结果     private static void func(ArrayList<Node> dList) {         //先在d中找最大的。         //定义一个数组,存储最大持续时间的位置下标         int[] a = new int[dList.size()];         int max = 0;         Collections.sort(dList);        //按照规则排序         res.clear();         //之后按照顺序选择         res.add(dList.get(0).start);         res.add(dList.get(0).end);         for (int i = 1; i < dList.size(); i++) {             Node node = dList.get(i);             //判断是否在区间内             int j = 0;             while (j < res.size() && node.start >= res.get(j)) {                 j++;             }             if (j % 2 == 0) {                 if (j == res.size() || node.end <= res.get(j)) {                     //直接加到最后                     res.add(node.start);                     res.add(node.end);                     Collections.sort(res);                 }             }         }     }     private static class ResultNode implements Comparable {         private int statr;         private int end;         public ResultNode(int statr, int end) {             this.statr = statr;             this.end = end;         }         public int getStatr() {             return statr;         }         public void setStatr(int statr) {             this.statr = statr;         }         public int getEnd() {             return end;         }         public void setEnd(int end) {             this.end = end;         }         @Override         public int compareTo(Object o) {             ResultNode n = (ResultNode) o;             if (this.end > n.end) {                 return 1;             } else {                 return -1;             }         }     }     private static class Node implements Comparable {         private int id;         private int start;         private int end;         private int len;         public Node(int id, int start, int end, int len) {             this.id = id;             this.start = start;             this.len = len;             this.end = end;         }         public int getEnd() {             return end;         }         public void setEnd(int end) {             this.end = end;         }         public int getId() {             return id;         }         public void setId(int id) {             this.id = id;         }         public int getStart() {             return start;         }         public void setStart(int start) {             this.start = start;         }         public int getLen() {             return len;         }         public void setLen(int len) {             this.len = len;         }         @Override         public int compareTo(Object o) {             Node n = (Node) o;             if (this.len > n.len) {                 return -1;             } else if (this.len < n.len) {                 return 1;             } else {                 if (this.start <= n.start) {                     return -1;                 } else {                     return 1;                 }             }         }     } }
点赞 回复
分享
发布于 2018-09-08 21:29
为什么投了好几天了都没有收到今天笔试的通知的怎么破???
点赞 回复
分享
发布于 2018-09-08 22:43

相关推荐

点赞 8 评论
分享
牛客网
牛客企业服务