题解 | #扭蛋机#

扭蛋机

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;
}
全部评论

相关推荐

见见123:简历没有啥问题,是这个社会有问题。因为你刚毕业,没有工作经历,现在企业都不要没有工作经历的。社会病了。
点赞 评论 收藏
分享
仁者伍敌:难怪小公司那么挑剔,让你们这些大佬把位置拿了
点赞 评论 收藏
分享
评论
5
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务