codeforces 解题报告 987B. High School: Become Human math

http://codeforces.com/contest/987/problem/B

解题思路:判断 x 的 y 次方和 y 的 x 次方的大小,无非就是判断几种情况

  • 两数相等,一定是等号
  • 一个数为2,另一个数为4,等号
  • 2的3次方小于3的2次方
  • 其余的都是较小值大


import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(),y = sc.nextInt();
        if(x == y || (Math.max(x,y) == 4 && x + y == 6)) {
            System.out.println("=");
        } else if((x == 3 && y < x) || y == 1) {
            System.out.println(">");
        } else if((y == 3 && x < y) || x == 1) {
            System.out.println("<");
        } else if(x < y) {
            System.out.println(">");
        } else if(x > y) {
            System.out.println("<");
        }
    }
}

猜你喜欢

转载自blog.csdn.net/a912952381/article/details/81063640