/** * @Author DragonOne * @Date 2021/9/4 19:40 */ publicclassMain{ publicstaticvoidmain(String[] args)throws Exception { Scanner Scin = new Scanner(System.in); StreamTokenizer STcin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); BufferedReader BRcin = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
List<NBB> list = new ArrayList<>(); int t; t = Scin.nextInt(); for (int i = 0; i < t; i++) { NBB nbb = new NBB(); int h = Scin.nextInt(); nbb.setH(h); int m = Scin.nextInt(); nbb.setM(m); int s = Scin.nextInt(); nbb.setS(s); list.add(nbb); } Collections.sort(list, new cmp()); for(NBB it : list){ out.println(it.getH()+" "+it.getM()+ " "+ it.getS()); out.flush(); } }
publicstaticclassNBB{ publicNBB(){ } int h; int m; int s; @Override public String toString(){ return"NBB{" + "h=" + h + ", m=" + m + ", s=" + s + '}'; }
publicintgetH(){ return h; } publicvoidsetH(int h){ this.h = h; } publicintgetM(){ return m; } publicvoidsetM(int m){ this.m = m; } publicintgetS(){ return s; } publicvoidsetS(int s){ this.s = s; } publicNBB(int h, int m, int s){ this.h = h; this.m = m; this.s = s; } }
/** * @Author DragonOne * @Date 2021/9/4 19:40 */ publicclassMain{ publicstaticvoidmain(String[] args)throws Exception { Scanner Scin = new Scanner(System.in); StreamTokenizer STcin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); BufferedReader BRcin = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
List<NBB> list = new ArrayList<>(); int t; t = Scin.nextInt(); for (int i = 0; i < t; i++) { NBB nbb = new NBB(); int h = Scin.nextInt(); nbb.setH(h); int m = Scin.nextInt(); nbb.setM(m); int s = Scin.nextInt(); nbb.setS(s); list.add(nbb); } Collections.sort(list); for (NBB it : list) { out.println(it.getH() + " " + it.getM() + " " + it.getS()); out.flush(); } }
publicstaticclassNBBimplementsComparable{ publicNBB(){ } publicint h; publicint m; publicint s; @Override public String toString(){ return"NBB{" + "h=" + h + ", m=" + m + ", s=" + s + '}'; } publicintgetH(){ return h; } publicvoidsetH(int h){ this.h = h; } publicintgetM(){ return m; } publicvoidsetM(int m){ this.m = m; } publicintgetS(){ return s; } publicvoidsetS(int s){ this.s = s; } publicNBB(int h, int m, int s){ this.h = h; this.m = m; this.s = s; } @Override publicintcompareTo(Object O){ NBB o = (NBB) O; if (this.h < o.h) { return -1; } elseif (this.h > o.h) { return1; } else { if (this.m < o.m) { return -1; } elseif (this.m > o.m) { return1; } else { if (this.s < o.s) { return -1; } elseif (this.s > o.s) { return1; } else { return0; } } } } }