代码实现:
import java.util.*; import java.io.*; public class Main{ public static void main(String[] args){ Scanner cin = new Scanner(new BufferedInputStream(System.in)); int n = cin.nextInt(); StringBuilder ans = new StringBuilder(); while(n!=0){ if((n&1)==1){ n=(n-1)/2; ans.append('2'); }else{ n=(n-2)/2; ans.append('3'); } } System.out.println(ans.reverse()); } }