会议安排

import java.util.*;

public class Exam {

    static class Letcure {

        public int b;
        public int e;

        public Letcure(int b, int e) {
            this.b = b;
            this.e = e;
        }
    }
    private static List list = new ArrayList<>();
    private static List outputList = new ArrayList<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String[] c = sc.nextLine().split(" ");
            int res = solution(c);
            System.out.println("count:"+res);
            for (int i = 0; i  list = new ArrayList<>();
        for (int i = 0; i < c.length; i++) {
            String[] cou = c[i].substring(1, c[i].length() - 1).split(",");
            int b = Integer.parseInt(cou[0]);
            int e = Integer.parseInt(cou[1]);
            Letcure letcure = new Letcure(b, e);
            list.add(letcure);
        }
        Collections.sort(list,new Comparator() {
            @Override
            public int compare(Letcure o1, Letcure o2) {
                return o1.e==o2.e?o2.b - o1.b:o1.e-o2.e;
            }
        });
        int lE=list.get(0).e;
        outputList.add(list.get(0));
        for (int i = 1; i < list.size(); i++) {
            if(list.get(i).b>=lE){
                lE=list.get(i).e;
                outputList.add(list.get(i));
            }
        }
        return outputList.size();

    }

}

你可能感兴趣的:(windows)