根据给定的N值往前倒推即可。N如果为偶数,说明是3投的;如果为奇数,说明是2投的。注意最后要反转。 #include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int N; while (cin >> N) { string ans = ""; while (N != 0) { if (N % 2 == 0) { ans += "3"; N = (N - 2) / 2; } else...