hiho week 98 register

Ended

Participants:433

Verdict:Accepted
Score:100 / 100
Submitted:2016-05-19 16:51:38

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 {
    private static double operation(double adouble bint type) {
        switch (type) {
            case 0return a + b;
            case 1return a - b;
            case 2return a * b;
            case 3:
                if (b != 0return a / b;
                else return -1;
            case 4return b - a;
            case 5:
                if (a != 0return b / a;
                else return -1;
            defaultreturn -1;
        }
    }
    private static boolean calc() {
        if (Math.abs(operation(operation(operation(chosenNum[0], chosenNum[1], op[0]), chosenNum[2], op[1]), chosenNum[3], op[2]) - 24< 0.0001) {
            return true;
        }
        if (Math.abs(operation(operation(chosenNum[0], chosenNum[1], op[0]), operation(chosenNum[2], chosenNum[3], op[2]), op[1]) - 24< 0.0001) {
            return true;
        }
        return false;
    }
    private static void DFS(int p) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX