题解 | #数码#

数码

https://www.nowcoder.com/practice/0d5f65e85f784ba78dad8be8d9ee084d

#include <bits/stdc++.h>

using namespace std;

void slove(vector<int>& ret,int x){
    if(x < 5){
        ret[x]++;
        return;
    }

    slove(ret,x/5);
    slove(ret,x%5);
    slove(ret,x/5);
}

int main() {
   int x;
   cin >> x;
   vector<int> ret(5);
   slove(ret,x);
   for(auto val : ret) cout << val << " ";
   return 0;
}

全部评论

相关推荐

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