题解 | #扭蛋机#

扭蛋机

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

相关推荐

能干的三文鱼刷了100道题:公司可能有弄嵌入式需要会画pcb的需求,而且pcb能快速直观看出一个人某方面的实力。看看是否有面试资格。问你问题也能ai出来,pcb这东西能作假概率不高
点赞 评论 收藏
分享
Rena1ssance_:对的,要是面评没太烂,勤更新简历等捞就行了,腾讯可以无限复活
点赞 评论 收藏
分享
评论
5
收藏
分享

创作者周榜

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