一步两步,此类问题都是斐波那契问题,从最后往前看,最后一步必定是2或3.

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        StringBuilder s = new StringBuilder();
        while (n > 0) {
            if(n % 2 == 0){
                s.insert(0, "3");
                n = (n - 2) / 2;
            }else{
                s.insert(0, "2");
                n = (n - 1) / 2;
            }
        }
        System.out.println(s);
    }
}