题解 | #扭蛋机#

扭蛋机

http://www.nowcoder.com/practice/9d26441a396242a9a0f7d2106fc130c7

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int main() {
    int n;
    string res;
    cin >> n;
    while(n) {
        if(n & 1) n = (n-1) >> 1, res += '2';
        else n = (n-2) >> 1, res += '3';
    }
    cout << string(res.rbegin(), res.rend()) << endl;
    return 0;
}
全部评论

相关推荐

5 收藏 评论
分享
牛客网
牛客企业服务