思路:
从后往前思考,偶数用扭蛋机3号,奇数用扭蛋机2号,每次更改n的值,统计路径
代码:
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
string res = "";
cin >> n;
while(n != 0){
if(n % 2 == 0){
n = (n-2)/2;
res = '3' + res;
}else{
n = (n-1)/2;
res = '2' + res;
}
}
cout << res << endl;
return 0;
}