Code Hunt 第一章算术篇答案

废话不多说,直接上结果

01.01

public class Program {
    public static int Puzzle(int x) {
        return 0-x;
    }
}

01.02

public class Program {
    public static int Puzzle(int x) {
        return x-2;
    }
}

01.03

public class Program {
    public static int Puzzle(int x) {
        return x*x;
    }
}
01.04
public class Program {
    public static int Puzzle(int x) {
        return 3*x;
    }
}

01.05

public class Program {
    public static int Puzzle(int x) {
        return x/3;
    }
}

01.06

public class Program {
    public static int Puzzle(int x) {
        return 4/x;
    }
}

01.07

public class Program {
    public static int Puzzle(int x, int y) {
        return x-y;
    }
}

01.08

public class Program {
    public static int Puzzle(int x, int y) { 
        return x+2*y;
    }
}
01.09

public class Program {
    public static int Puzzle(int x, int y) {
        return x*y;
    }
}

01.10

public class Program {
    public static int Puzzle(int x, int y) {
        return (3 * x + y) / 3;
    }
}

01.11

public class Program {
    public static int Puzzle(int x, int y) { 
        return x/y;
    }
}

01.12

public class Program {
    public static int Puzzle(int x) {
        return x%3;
    }
}

01.13

public class Program {
    public static int Puzzle(int x) {
        return x%3+1;
    }
}

01.14

public class Program {
    public static int Puzzle(int x) {
        return 10%x;
    }
}

01.15

public class Program {
    public static int Puzzle(int x, int y, int z) {
        return (x + y + z)/3;
    }
}




你可能感兴趣的:(Code Hunt 第一章算术篇答案)