hihoCoder太阁最新面经算法竞赛12 register

Ended

Participants:164

Verdict:Accepted
Score:100 / 100
Submitted:2016-10-24 01:21:27

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;
/**
 * Created by will on 24/10/16.
 */
public class Main {
    static String ans = "";
    static int best = -1;
    static int[] arr = null;
    static int[] now = null;
    static boolean[] flag = null;
    static void Go(int k) {
        if (k == 4) {
            int h = now[0]*10+now[1];
            int m = now[2]*10+now[3];
            if (h >=0 && h <= 23 && m >= 0 && m <= 59 && h*100+m > best) {
                best = h*100+m;
                ans = ""+now[0]+now[1]+":"+now[2]+now[3];
            }
            return;
        }
        for (int i = 0i < 4i++)
            if (!flag[i]) {
                flag[i= true;
                now[k= arr[i];
                Go(k+1);
                flag[i= false;
            }
    }
    public static void main(String[] agrs) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX