[Offer收割]编程练习赛28 register

Ended

Participants:277

Verdict:Accepted
Score:100 / 100
Submitted:2017-09-24 12:47:23

Lang:Java

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int routine = in.nextInt();
        int[] aTime = new int[6];
        int[] max = new int[6];
        
        for(int i=0;i < routine;i++){
            String s = in.next();
            aTime[0= s.charAt(0)-'0';
            aTime[1= s.charAt(1)-'0';
            
            aTime[2= s.charAt(3)-'0';
            aTime[3= s.charAt(4)-'0';
            
            aTime[4= s.charAt(6)-'0';
            aTime[5= s.charAt(7)-'0';
            int min =  9;
            for(int j=0;j < 6;j++){
                max[j= aTime[j];
                int maxDis = Integer.MAX_VALUE;
                
                for(int k=0;k < 6;k++){
                    if(aTime[k> aTime[j&& aTime[k- aTime[j< maxDis){
                        max[j= aTime[k];
                        maxDis = aTime[k- aTime[j];
                    }    
                }
                if(aTime[j< min){
                    min = aTime[j];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX