题解 | #扭蛋机#
扭蛋机
https://www.nowcoder.com/practice/9d26441a396242a9a0f7d2106fc130c7
#include <iostream> #include <vector> using namespace std; int main() { int a; while (cin >> a) { // 注意 while 处理多个 case vector<char> res; while(a) { if(a % 2 == 0) { res.push_back('3'); a = (a-2)/2; } else if(a % 2 != 0) { res.push_back('2'); a = (a-1)/2; } } vector<char>::iterator i = res.end() - 1; while(i != res.begin() - 1) { cout << *i; i--; } } } // 64 位输出请用 printf("%lld")
啥b题目